Check word in sentence (command nightbot)

how to check word in sentence
am add command haha (send message have fun)
P = person
N = nightbot
Ex1
P : haha
N : have fun
Ex2
P : hello how are you haha
N : (don’t send message)
Ex3
P : haha i dont knew
N : (don’t send message)
Ex4
P : No haha am fire
N : (don’t send message)

How to Ex2,Ex3,Ex4 Nightbot can send message?

!addcom haha have fun

Nightbot can only test the first word in a message for a command. So you need to anticipate which words chatters might start their messages with and then add multiple commands with those words as the command names. For example:

!addcom hello $(eval /haha/i.test(decodeURIComponent("$(querystring)"))?"have fun":" ")
!addcom hi $(eval /haha/i.test(decodeURIComponent("$(querystring)"))?"have fun":" ")
!addcom no $(eval /haha/i.test(decodeURIComponent("$(querystring)"))?"have fun":" ")
1 Like

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