Hi. I’m trying to create a command that makes nightbot reply to phrases in chat. the purpose of the command is to reply to users who ask the streamer if he or she can play with them. I found a basic way to do this command here: !commands edit can $(eval var a = "$(query)"; if (a === "I play?") { ("$(user) Please do not ask Lexi to play. If you are on the stream often and give off chill vibes, Lexi might invite you to play if there's room in the squad ❤️"); } else { (" "); })
However the problem is with this, the command cannot detect variations of the phrase “can” followed by “I play” or “i play” or “i play?” (different capitalizations and with or without a question mark). How can I edit the aforementioned command to include more “detection phrases?” I appreciate any and all help. thanks!
Case-insensitive search for if query has “I play”. Basically turn the whole query string lower/uppercase and use includes() method:
!commands edit can $(eval decodeURIComponent("$(querystring)").toLowerCase().includes("i play")?"$(user) Please do not ask Lexi to play. If you are on the stream often and give off chill vibes, Lexi might invite you to play if there's room in the squad ❤️":" ")
!commands edit can $(eval a=decodeURIComponent("$(querystring)").toLowerCase();a.includes("i play")||a.includes("i join")?"$(user) Please do not ask Lexi to play. If you are on the stream often and give off chill vibes, Lexi might invite you to play if there's room in the squad ❤️":" ")