!hug command being abused

Hi guys,

I’m not quite sure how to fix this, but we currently have a !hug command on our YouTube live stream that’s really popular with the chat. However, every so often we have spam bots and people generally messing about with the command.

For example - at the moment the command is: “!hug” which returns: “Here you go $(touser) :hugs: ($(count) hugs have been given)”

However, the issue is that someone can do “!hug inappropriate message” and as a result Nightbot returns that query.

Is there a way to enable people to do !hug and @ a specific person in chat but not be able to type random inappropriate messages?

I suggest setting up a blacklist: https://docs.nightbot.tv/spam-protection/blacklist

Not sure that will be the solution for this.

If you’re using $(touser) then at most one word will be returned. You can turn it into $(twitch $(touser) "{{displayName}}") which will both show the relevant user’s displayname instead of their username, and if it’s an unknown user will show “Unknown Twitch User” or something to that effect.

What about for YouTube? (We don’t use nightbot on twitch)

No idea, sorry. I don’t use Nightbot on Youtube. But in general the issue can’t really be prevented because effectively $(touser) is user input and user input can always include something you weren’t expecting. There’s no way for Nightbot to filter that, that people aren’t going to work around.

I’d say ban people who abuse it like that.

There’s not a way to restrict it to usernames, since Nightbot cannot know if what you typed is a username without querying YouTube’s API (YouTube display names can be any characters). Setting up a blacklist could help if the bad words people type are common, since Nightbot will process filters like the blacklist before commands.

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