I try to create a command that when the “Hi” Emote is used from one in the chat, that Nightbot response with the same “Hi” Emote.
Right now is the command: “Hi Emote” $(user)
the problem is when someone use this emote with a name behind it triggers too.
So i try to find a way that it triggers only when the Emote only is written from a Person or the Emote + @mytwitchname
If someone uses the Emote + Text or a other @twitchname then it should not trigger
I thought this should work with if and else or I’m on the wrong way?
If I understand properly, your issue is that you want your command to answer only when the chatter sends the following message:
Hi 😉
(the emoji is a placeholder)
and yet Nightbot also answers when the chatter sends:
Hi 😉 otherChatter
and that’s the issue, have I got that correctly?
That’s likely because you’re using .includes() in your code (that’s what I assume since that’s how we build the commands with spaces in their name; I can only assume because you haven’t provided the code, @Bigyan_subba asked you to, but it wasn’t a clear request), while here what you want is a strict match.
So with that in mind, that’s how you set up such command with strict match:
I had no code for this command because this worked "Emote” $(user) and I thought that is enough for this command but then I saw in the chat that Nightbot triggers always when the “Emote” comes in the chat and that was the problem.
I tried now your code example:
$(eval ‘$(query)’ === ‘HiEmote’ ? ‘HiEmote’ : ’ '
Oooh, wait, I think I got it, the command you’re trying to create has for name an emote, which is a greeting emote, “hi” is how you qualify the emote, not the message you wish Nightbot to reply to. Now everything makes sense!
Then this is quite different if you want the bot to reply only when the message content is the emote by itself:
Would have been less confusing if you just said it was an emote, without quotes, and didn’t qualify it.
I edited the title of the topic which now gives a clear picture, as it should be.