I am trying to make nightbot respond to good morning, good afternoon, good evening and good night.
Would the following work:
$(eval if ($(querystring $(1)).toLowerCase().includes(morning)) {Response Good morning $(user)!} else if (`$(querystring $(1))`.toLowerCase().includes(`afternoon`)) {`Response`😄 Good afternoon $(user)!} else if ($(querystring $(1)).toLowerCase().includes(evening)) {Response Good evening $(user)!} else if (`$(querystring $(1))`.toLowerCase().includes(`night`)) {`Response`😄 sweet dreams $(user)!}
Also, I exceed the character limit using the web interface so should I use !addcom for this?
This is my bad, I misplaced a character in my code: /^[a-z]/ instead of /[^a-z]/…
I fixed the code above, it should work as expected now.
However, you shouldn’t get empty responses when the message doesn’t match any valid inputs, I suspect this might be a difference between Twitch and YouTube: Twitch doesn’t accept empty messages (made of only spaces), maybe YouTube does when it comes from their API?
I suggest testing the command as is with a sentence like “good game.”
If Nightbot responds with an empty message you can try removing the space between the last two single quote marks: ' ';) → '';)
And although it usually produces error, I hope it’ll work because there’s no other solution.