Python Bot keeps get "Connection was lost" randomly... and rejoin the chat

Since Twitch has switched to AWS Chat Server…

I am using:
group.tmi.twitch.tv (6667) for whisper
irc.chat.twitch.tv (6667) for chat

When the bot received some !command data from the chat, it will terminate the bot’s connection.

(venv)root@us3vps2:~/kyrosbot# ./serve.py
Connecting to group.tmi.twitch.tv:6667
[09:49:17] [INFO] Sending Username KyrosBot
[09:49:17] [INFO] Sending Password oauth:xxxxxxxxxxxxxxxxxxxx
[09:49:17] [INFO] Sending Nick KyrosBot
[09:49:18] [INFO] Joining whisper server
[09:49:18] [INFO] Joined channels.
Connecting to irc.chat.twitch.tv:6667
[09:49:18] [INFO] Sending Username KyrosBot
[09:49:18] [INFO] Sending Password oauth:xxxxxxxxxxxxxxxxxxxx
[09:49:18] [INFO] Sending Nick KyrosBot
[09:49:18] [INFO] Joining channels #kyrosbot,#kyroskoh
[09:49:18] [INFO] Joined channels.
->* kyroskoh #kyroskoh !commands
[09:52:21 #kyroskoh] [BOT] Command is valid and not on cooldown. (!commands) (kyroskoh)
[09:52:21 #kyroskoh] [BOT] (kyroskoh) : A full list of Commands: http://pastebin.com/kjH1xkFz | Take a look at its features & awesome generous donators: https://www.twitch.tv/kyrosbot
->* nightbot #kyroskoh KyrosKoh -> The bot commands for this channel are available at https://beta.nightbot.tv/t/kyroskoh/commands
->* coebot #kyroskoh coeBot You can find the list of commands at coebot.tv/c/kyroskoh/#commands
Connection was lost
Connecting to irc.chat.twitch.tv:6667
[09:46:22] [INFO] Sending Username KyrosBot
[09:46:22] [INFO] Sending Password oauth:xxxxxxxxxxxxxxxxxxxx
[09:46:22] [INFO] Sending Nick KyrosBot
[09:46:22] [INFO] Joining channels #kyrosbot,#kyroskoh.
[09:46:22] [INFO] Joined channels.
->* neaseech #kyroskoh but then again, scical is a real grill too DansGame
->* puddingandmilk #kyroskoh This game too hards
Connection was lost
Connecting to irc.chat.twitch.tv:6667
[09:54:18] [INFO] Sending Username KyrosBot
[09:54:18] [INFO] Sending Password oauth:xxxxxxxxxxxxxxxxxxxx
[09:54:18] [INFO] Sending Nick KyrosBot
[09:54:18] [INFO] Joining channels #kyrosbot,#kyroskoh.
[09:54:18] [INFO] Joined channels.

This also happens when the bot received a normal text (not command)…

Sometimes it can response to chat/whisper, sometimes the connection breaks.

/w isn’t working either… Probably the Bot, KyrosBot is banned for over sending its limit to chat and whisper.

*And I have applied KyrosBot for a bot whitelist before Twitch Chat Servers are migrated. I am not sure what is the application outcome.

===

I have tested on another Twitch account, it works…

Try lower case username?

I have set it to lowercase but it is still failed with the same result.

How quick did your bot get disconnected? I got something similar the past few days with my own bot from a remote server not in my network but it didn’t get disconnected right away. (It did so, however, about a minute after it mysteriously stopped receiving data including pings and pongs from group chat servers, and I had to restart the whole thing to get it back up working. I’m currently investigating its cause as of writing.) And are you running your bot from your own network?

EDIT: The problem is a mistake in my own code that causes an infinite loop and therefore preventing my bot to do anything. You should check for them in your code just in case.

It has been resolved when it found out it is over the Twitch’s message limit and it’s not a problem in my code.

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