Nighbot responding to a sentence / command name with space

Asked Apr 20, 2021·4 replies·Last activity 5 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

How can i make nighbot reply to things like "whats up nighbot". Whenever I just type it in as a command it doesn't reply.

4 replies

Hey @Trusty Llama!

A command name can only be one "word," meaning there can't be no space, so here you'd have to create a command called what's, check if the rest of the sentence contains Nightbot, and if the check matches, then send a response.

!addcom what's $(eval `$(query)`.toLowerCase().includes(`nightbot`)?`YOUR_RESPONSE`:` `)

Can i do this with multiple words? Or is it one word and then if it contains the other word?

You can do this with full sentences if you'd like:

!addcom FIRST_WORD $(eval `$(query)`.toLowerCase().includes(`REST_OF_THE_SENTENCE_IN_LOWER_CASE`)?`YOUR_RESPONSE`:` `)

I just didn't to add more flexibility, but it's up to you.