How to set an alias

I have searched here and google, found one example of an alias: !donate $(alias !tip)

So I tried entering this line, on the line in the command entry box called Alias, similiar for my particular command and I get: The alias you set this command to be of, !–, does not exist.

If I understand this right, you have to make a command for the original plus the alias? so basically duplicating commands? surely not, I must be missing something? :pensive:

Any help is appreciated! thanks :relaxed:

1 Like

An alias is running another command with the input of whatever the message field of the new command is. So the aliased command needs to exist.

You can also use an alias to have two commands with different names but the same common message (and if you edit the original, all aliases match that one without needing to be touched), in that case it needs a command to know what it should say.

So, what exactly are you needing to do? If you have a specific situation or commands i can try to help out/help you understand.

1 Like

OK I’m new to these bots and in Moobot for example, you simply set the alias to point to the main command. I’m just not sure how to configure one command but with an alias in Nightbot. So yes, it would have the same common message.

So for example, if I want a command !yt with the common message being a url to youtube, but I would like an alias of !youtube also - what would I put in the box at the bottom of the command, the alias box?

Thanks very much!

Basically decide which command you want to be the base command: let’s assume !youtube (generally aliases are to make command names shorter). My commands and screenshot will show the adding of a base command and the aliasing of it with another command through chat, you can do it through the nightbot panel as well.

!commands add !youtube https://www.youtube.com/channel/UCSvjQBDgYDB5TGVmCZObcwA

!commands add !yt -a=!youtube $(query)

If you aren’t doing anything really strange it is best to just put $(query) into the message of the alias so that if you have any user input in the base command the alias still passes it.

In the nightbot panel it would look like this: https://i.imgur.com/PiyD0N0.png

In the future i believe nightbot will have the alias field give you a list of your commands to choose from, but for now you just put in the base command.

6 Likes

There we have it! :heart_eyes:

So it is using two commands, that’s what was confusing me.
Thanks very much :smiley:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.