Phrase recognition

Is there a way to have a command triggered by a specific phrase? For example, if any user were to ask “Is she drunk?” the command would be triggered and provide a line of text. If so, how? I’m a below a noob when it comes to coding.

It’s technically possible with $(eval) (i think) but not with default nightbot, if you want it i can probably make a solution that uses $(eval) for you.

I’m not actually sure you’d be able to do it with eval, unless there’s something I’m missing, you can’t actually get the full message string to check it? :thinking:

$(query) gives you the full message.

I thought query just gave you everything that just came after the command trigger?

yes, and if you have the command trigger set to “is” you can check that query follows up with “she drunk?”

Oh yeahhhhhhhhhhhhhh.

I would really appreciate that.

Just put the message you want to be displayed where [YOUR_MESSAGE_HERE] is, replacing the [] as well

!commands add is $(eval var q = `$(query)`; q.startsWith("she drunk?") ? "[YOUR_MESSAGE_HERE]" : "")
1 Like

Awesome! thanks!
One question though. Why does it sometimes come back with “[Error Connecting To WebEval Service]” ?
Also, is it possible that in addition to “she drunk?” another condition for the command to trigger to be “Teo drunk?” I tried doing it on my own but it would give me the response mentioned above.

The problem seems to be when something other than “she drunk” is said after “is”, the command trigger

Try this:

!commands add is $(eval var a = "$(query)"; 
if (a === "she drunk?") {
} else {
(" ");

Should fix the problem of it triggering whenever “is” is said.

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