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)
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":" ")