Custom Greeting Commands Help

Asked Aug 28, 2020·5 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.

I wanted to know if there's a way to make nightbot respond to a greeting, I have a "hello" command, but the bot will respond if it's used in a sentence that is not a greeting making it kinda awkward...was wondering if there's a way to fix this

5 replies

Hey @Stormy Deer!

Yes, just add a test before sending a reply, like this:

!editcom hello $(eval q=decodeURIComponent(`$(querystring)`).toLowerCase();q==``||q==`nightbot`||q==`volantem`?`Hello $(user)!`:` `;)

In this case Nightbot will only reply if someone says hello, hello Nightbot or hello volantem.

Polar Cat said:
```
!editcom hello $(eval q=decodeURIComponent($(querystring)).toLowerCase();q==`||q==nightbot||q=volantem?Hello $(user)!: `;)
```

Thanks for the reply! Also, I keep getting this error message "Invalid left-hand side in assignment"

My bad, I forgot an =, I edited the code in my previous reply, it should work properly now.

Polar Cat said:
```
!editcom hello $(eval q=decodeURIComponent($(querystring)).toLowerCase();q==`||q==nightbot||q==volantem?Hello $(user)!: `;)
```

Hey sorry for late reply...haven't had a chance to mess around in nightbot for a while. I tried it out and it works...but now it will show an emoji whenever I use "hello" in a sentence. Any way to fix that? Thanks for your help, really appreciate it! <3

I'm not sure why it's happening, if you haven't changed the code it shouldn't be an issue. I don't even know how Nightbot could be triggered if the "hello" is in the middle of a sentence since it's not able to detect words that aren't the first one.
I tested it again to make extra sure it was working as intended:

AI1Xhb2Aui.png

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

Ask on Discord