Nightbot returns undefined

Asked Oct 26, 2020·2 replies·Last activity 5 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hello,

I have made a command a long time ago that would check what a user says in chat after for example hello like this:

$(eval
var r = false;
if('$(query)' === "")
r = "Hi $(user)";
else if('$(query)' === "streamername")
r = "Hi $(user)";
if(r) r;
else die;
)

but for some reason the die doesn't work anymore(this worked when i made it, somewhat a year ago), now i know that die is ment to kill a function wich is clearly missing here.

But i've tried everything to stop nightbot from responding if none of the if selection matches,
I've used break, die, r = "". but all of my attempts seems to return undefined, or failed to connect to eval service(i assume a timeout because the code is not right).

Is there anyway to stop nightbot from responding when a user doesn't say just 'hello' or hello 'streamername'?

My current workaround has been this:

$(eval var r = false;if('$(query)' === "")r = "Hi $(user)";else if('$(query)' === "streamername")r = "Hi
$(user)";if(r) r;else r = "TakeNRG";)

2 replies

Hiya, if you return a space " " Nightbot won't output anything.

Thank you, that was one thing i did not try and it works just as expected now 🙂