Open Commaster opened 1 year ago
Hello! Thanks for the issue. If this is a general help question, for a faster response consider joining the official Discord Server
Else if you have an issue with the library please wait for someone to help you here.
Notices are handled in master by dispatching to the event. Check for this message and then perform whatever action you wish to do. E.g. stop the bot booting up as you must have an invalid token.
Assuming this is start up since you mention Client.run() as well as not being a commands Bot. If this during runtime after RECONNECT then you haven't refreshed your token.
token is valid since it passes the HTTP validate test each time and also connects correctly sometimes (~ 10% of the attempts). Yes, this at startup, so I have to Ctrl+C the app and restart each time this happens.
Btw, this is a special NOTICE which is handled before the action selection: https://github.com/TwitchIO/TwitchIO/blob/master/twitchio/websocket.py#L349
So this wouldn't be related to master, it would be to all versions. Although I never have a 90%, fail rate and if it was that consistent for everyone they would have raised an issue by now.
This only happens when Twitch itself is having server issues, so you have to try over and over and eventually it'll work. 90% is just my guesstimate. I can reproduce this issue with a desktop IRC client as well: After several reconnects it'll let me it.
Okay that makes more sense, thanks. Finding a window to test a potential fix for this on would be difficult.
Wouldn't it be sufficient to just feed the app :tmi.twitch.tv NOTICE * :Login unsuccessful
as the first data line to trigger that special handling?
I understand that we can't fix all connection issues, but maybe it's possible to fix this asyncio Error and raise something inside Client/Bot? This would correctly terminate .run(), enabling the users to handle this login failure in some way (either accept it or re-run .run()).
In this case it doesn't make sense to terminate the bot and restart. If the token has passed validation it makes more sense to allow a backoff to handle it until it can successfully resume.
I have the same issue!
I believe this could be related to the Summer Games Showcase event that started on June 8 and the Twitch services would have been overloaded causing connection issues. This hasn't really ever been an issue, as far as I know, up until this event, otherwise we would have probably encountered this more regularly. We'll look into potentially adding an exponential backoff reconnect.
still get this sometimes
So twitch is having another stroke and 90% of the connection attempts receive this IRC message. But TwitchIO (latest master commit) fails to correctly handle it and the
Client.run()
method I'm using never returns or raises. Instead we get this from asyncio: