NightDev Community Forums

How do I set commands with multiple words?

Basically I’d like a command where anyone types “Hello there” in the chat and Nightbot replies with “General Kenobi!”
I understand Nightbot commands have to be one word to trigger but I read a response to an old thread that wasn’t further explored or confirmed: Multi-word command - #2 by xgerhard

I do not know how to code and barely understand code related jargon.

Hiya, with $(evil) you can run custom code, so we can create a command that runs when someone types ‘hello’ and we will have to check the rest of the sentence inside the command:

!commands add hello $(eval `$(querystring)`.toLowerCase() == `there` ? `response here` : ` `)
2 Likes

This will only respond to exactly “Hello there” which if that’s to strict you could make a slight alteration to have it handle more situations like “Hello there!” Or “Hello there Streamer”

!addcom hello $(eval `$(querystring $(1))`.toLowerCase().includes(`there`)?`Response`:` `)
4 Likes

Oh this is super helpful! Thankyou for the help, I greatly appreciate it. <3