Eval Conditional Output

I have a command that will respond, correctly, if the user uses the correct command in chat. It is using a regex to test for the existence of the command. But since Nightbot checks the first word ONLY, the command may not fire since the second word could be incorrect.

Example:
COMMAND : be
– EVAL check for the word “cool” as the second word
IF TRUE, RESPONSE : message
IF FALSE, I want to exit but I get a “Nightbot: undefined” response.

How can I exit out gracefully?

Thanks

No need for regex, just check the 1st input word.

!addcom -cd=5 be $(eval decodeURIComponent(`$(querystring)`).split(` `)[0].toLowerCase()==`cool`?`MESSAGE`:` `)

How can check the whole message for certain words?

Just don’t split

$(eval q=decodeURIComponent(`$(querystring)`); // Write code here for all the tests you want to do on q)

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