I wanted to know if there’s a way to make nightbot respond to a greeting, I have a “hello” command, but the bot will respond if it’s used in a sentence that is not a greeting making it kinda awkward…was wondering if there’s a way to fix this
Hey @volantem!
Yes, just add a test before sending a reply, like this:
!editcom hello $(eval q=decodeURIComponent(`$(querystring)`).toLowerCase();q==``||q==`nightbot`||q==`volantem`?`Hello $(user)!`:` `;)
In this case Nightbot will only reply if someone says hello
, hello Nightbot
or hello volantem
.
Thanks for the reply! Also, I keep getting this error message “Invalid left-hand side in assignment”
My bad, I forgot an =
, I edited the code in my previous reply, it should work properly now.
Hey sorry for late reply…haven’t had a chance to mess around in nightbot for a while. I tried it out and it works…but now it will show an emoji whenever I use “hello” in a sentence. Any way to fix that? Thanks for your help, really appreciate it! <3
I’m not sure why it’s happening, if you haven’t changed the code it shouldn’t be an issue. I don’t even know how Nightbot could be triggered if the “hello” is in the middle of a sentence since it’s not able to detect words that aren’t the first one.
I tested it again to make extra sure it was working as intended:
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.