Nightbot returns undefined


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

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";)

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 :slight_smile:

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