How to set default value? plz help

I searched a lot of information, and didn’t get the answer.
I want to set a command. hope it would work like:

input: !hello tony output: good morning! tony

or if I only call the command, like:

input: !hello output: good morning! XXX

XXX should be the name who call this command. I hope the user name is the default value of my command.

I have known [user] is a variable, but I don’t know how to set a default for my command.
How can I do this? I can’t find if-else in nightbot. please help

Try this:
!commands add !hello Good morning $(touser)!


@alify1017: In regards to “If-Else”, you can use Javascript in Nightbot commands if you contain it within the $(eval) variable like this:

Example command:

If you type !test Hello (case-sensitive) Nightbot will respond with “Hello there!”… otherwise it’ll respond with “Ok then”.

@xgerhard: thanks! I didn’t realize $(touser) have a default value.
I never think of there’s a default for normal command.
I have already set my command. Thanks a lot !

@Monario: thank for you exanple. I have known if-else statment can be done by javascript,
but I have no idea how to use, especially its variable. It is very helpful. Thx

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