Teekeks / pyTwitchAPI

A Python 3.7 compatible implementation of the Twitch API, EventSub, PubSub and Chat
https://pytwitchapi.dev
MIT License
254 stars 38 forks source link

Chat bot closing websocket after sending NICK #214

Closed stolenvw closed 1 year ago

stolenvw commented 1 year ago

Intermittent bug of chat bot closing connection before fully starting and getting a "CAP * ACK" reply.

twitchAPI.chat log

2023-02-12 12:38:25 - DEBUG - twitchAPI.chat: starting chat...
2023-02-12 12:38:25 - DEBUG - twitchAPI.chat: connecting...
2023-02-12 12:38:26 - DEBUG - twitchAPI.chat: > "CAP REQ :twitch.tv/membership twitch.tv/tags twitch.tv/commands"
2023-02-12 12:38:26 - DEBUG - twitchAPI.chat: > "PASS oauth:removed"
2023-02-12 12:38:26 - DEBUG - twitchAPI.chat: > "NICK removed"
2023-02-12 12:38:26 - DEBUG - twitchAPI.chat: chat started up!
2023-02-12 12:38:26 - DEBUG - twitchAPI.chat: websocket is closing

my code and rest of modules from twitchAPI log.

2023-02-12 12:38:24 - DEBUG - bot.bot.chat.twitchchat: Validate return for removed: {'client_id': 'removed', 'login': 'removed', 'scopes': [<AuthScope.CHANNEL_MODERATE: 'channel:moderate'>, <AuthScope.CHAT_EDIT: 'chat:edit'>, <AuthScope.CHAT_READ: 'chat:read'>, <AuthScope.WHISPERS_READ: 'whispers:read'>], 'user_id': 'removed', 'expires_in': 10292}
2023-02-12 12:38:25 - DEBUG - twitchAPI.twitch: making GET request to https://api.twitch.tv/helix/users
2023-02-12 12:38:25 - INFO - bot.bot.chat.twitchchat: Starting twitch chat bot as removed
Teekeks commented 1 year ago

This should probably be addressed by c5156db40421db1cc3c88fee8d26f182a17e8f12

stolenvw commented 1 year ago

woke up to about 9 hours of this in my log

2023-02-22 22:57:00 - DEBUG - twitchAPI.chat: websocket is closing
2023-02-22 22:57:00 - DEBUG - twitchAPI.chat: reconnecting...
2023-02-22 22:57:00 - DEBUG - twitchAPI.chat: > "CAP REQ :twitch.tv/membership twitch.tv/tags twitch.tv/commands"
2023-02-22 22:57:00 - DEBUG - twitchAPI.chat: > "PASS oauth:removed"
2023-02-22 22:57:00 - DEBUG - twitchAPI.chat: > "NICK angabens"
2023-02-22 22:57:00 - DEBUG - twitchAPI.chat: < :tmi.twitch.tv CAP * ACK :twitch.tv/membership twitch.tv/tags twitch.tv/commands
2023-02-22 22:57:00 - DEBUG - twitchAPI.chat: got CAP reply, granted caps: twitch.tv/membership twitch.tv/tags twitch.tv/commands
2023-02-22 22:57:00 - DEBUG - twitchAPI.chat: < :tmi.twitch.tv NOTICE * :Login authentication failed
2023-02-22 22:57:10 - DEBUG - twitchAPI.chat: websocket is closing
2023-02-22 22:57:10 - DEBUG - twitchAPI.chat: reconnecting...
2023-02-22 22:57:11 - DEBUG - twitchAPI.chat: > "CAP REQ :twitch.tv/membership twitch.tv/tags twitch.tv/commands"
2023-02-22 22:57:11 - DEBUG - twitchAPI.chat: > "PASS oauth:removed"
2023-02-22 22:57:11 - DEBUG - twitchAPI.chat: > "NICK angabens"
2023-02-22 22:57:11 - DEBUG - twitchAPI.chat: < :tmi.twitch.tv CAP * ACK :twitch.tv/membership twitch.tv/tags twitch.tv/commands
2023-02-22 22:57:11 - DEBUG - twitchAPI.chat: got CAP reply, granted caps: twitch.tv/membership twitch.tv/tags twitch.tv/commands
2023-02-22 22:57:11 - DEBUG - twitchAPI.chat: < :tmi.twitch.tv NOTICE * :Login authentication failed
2023-02-22 22:57:21 - DEBUG - twitchAPI.chat: websocket is closing

the token it was sending for the 9 hour was the same, not sure why it didnt try and refresh to get a new one.

Teekeks commented 1 year ago

It seems like 3.9.0 did fix this. Please reopen if I am wrong :D