Multiple Messages Sent from one line of code in chatbot

Hi, I am in the process of coding a python chatbot for a War Thunder streamer, and I’ve been testing it a bit on my own channel. Receiving and parsing messages works fine, and I am able to automatically send a response to the chat as well. However, besides the first time the program receives a trigger word (the program works perfectly then), I get duplicates of the message in the chat, when my program only executes one line of code and sends one message. Twitch ChatBot Multiple PRIVMSG Error The trigger word is “!request” so the program only sends messages when somebody types that in the chat.

Any help would be appreciated. Thanks

sock.send should be nearer

socket.send("PRIVMSG #channel :message\r\n")

You don’t need to send the parts before PRIVMSG. It shoukd start PRIVMSG

Thanks for the quick response. I’m really new to this.

I deleted all the user tags but nothing changed. The number of duplicates seems to increase each time I restart the program. The bot responded 7 times. Closing and restarting the stream or doing the same for the code doesn’t help either.

I hosted my own stream, viewed it with a second account, and ran the code from a third account. When I typed “!request ” from the second account, the bot account answered in the correct way with one response, while the account that I was streaming from answered with the same response but it answered three times. Number of duplicate responses doesn’t increase anymore.

Sounds like you have multiple copies of the code running

Indeed I did. Didn’t close my terminals after using them. Thanks

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