'i want my twitch chat bot to respond to a specific user with a specific reply
Im building a twitch chat bot using nodejs and i am bit stuck. So i want the bot to reply with a specific message only if a specific user write something. i already set up some replies to basic stuff but i cannot figure out how to do it. so im guessing i need an if statement .... if x says whatever - return this. but im not sure how to set it up to reply with the same thing no matter what that specific user does. ps. its my first time using nodejs or anything coding related.
thank you.
Solution 1:[1]
if you want to reply to specific user every time he wrote sth and no matter what (according to your question I think this is what you are looking for):
if (context.username == "YourSpecificUserName") {
client.say(channel, `Responding to ${context.username}: Hello my friend.`)
}
anyway, if you want to reply to specific message from specific user:
if (message == "whateverMsg" && context.username == "YourSpecificUsername") {
...
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jakub Kurdziel |