Team in two words

Asked Jun 6, 2020·8 replies·Last activity 6 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 to make a team in two words?
For example: how are you
The bot replies: good

8 replies

Hey @Loyal Bat!

Here's the solution:

!addcom how $(eval q=decodeURIComponent(`$(querystring)`); q.includes(`are you`)?`Good`:` `;)

How do add multiple strings in includes, ie: Hello + all / everyone / everyone? Thanks

Hey @Spiffy Rabbit!

I'm not sure I understand what you mean, if you want to have multiple tests done on q, use the logical operator || (OR).
For example:

!addcom hello $(eval q=decodeURIComponent(`$(querystring)`); q.includes(`all`)||q.includes(`everyone`)?`Hello $(user)`:` `;)

I'm afraid I can't offer better assistance without a clearer explanation of what you want.

The command field is just the word that needs to trigger Nightbot, so you can just set that to "how", put the $(eval ) part in the message field.

As xgerhard said, this is how to set up a command from the dashboard:

When you see !commands add or !addcom it's the way to add it from the chat.

er1Pej1IkS.png

1 more question: I want the bot to answer the question for me and the audience. For example, the Viewer writes-hi (my nickname), the bot responds hi. The viewer writes-hi bot, bot replies-hi. But if the viewer writes just Hello, the bot should be silent. how do I prescribe it?

This should do the trick:

!addcom hi $(eval q=`$(query)`.toLowerCase(); q.includes(`YOUR_USERNAME_IN_LOWER_CASE`)||q.includes(`nightbot`)?`Hi $(user)`:` `;)

Just replace YOUR_USERNAME_IN_LOWER_CASE, for example Bublik should be bublik in the command.
And if you want to have the bot reply for hello and hey as well, feel free to update the command, or to use alias commands, like so:

!addcom hello -a=hi $(query)
!addcom hey -a=hi $(query)

Didn't find your answer? The community is on Discord.

Ask on Discord