Hello, I just recently learned about Nightbot and I understand very poorly. How can I make the bot respond also to a word in a sentence, and not just to a single word in chat.
For example, if there are extra words near the command, then the bot no longer responds to the command. Thank you.
How can I make the bot respond also to a word in a sentence?
1 reply
Hey @Topaz Crocodile!
Please use the search bar before opening a new topic:
/t/nighbot-responding-to-a-sentence-command-name-with-space/15346363392306709…
If you want the bot to no longer answer when there's words after the command call, simply switch the logic:
!addcom FIRST_WORD $(eval `$(query)`.toLowerCase().includes(`REST_OF_THE_SENTENCE_IN_LOWER_CASE`)?`YOUR_RESPONSE`:` `)
becomes:
!addcom FIRST_WORD $(eval !`$(query)`.toLowerCase().includes(`REST_OF_THE_SENTENCE_IN_LOWER_CASE`)?`YOUR_RESPONSE`:` `)
or:
!addcom FIRST_WORD $(eval `$(query)`.toLowerCase().includes(`REST_OF_THE_SENTENCE_IN_LOWER_CASE`)?` `:`YOUR_RESPONSE`)