Working on: The Twitch authentication

This commit is contained in:
2025-12-25 18:34:44 +01:00
parent 8521510215
commit cfc082a6f8

View File

@@ -18,17 +18,13 @@ class TwitchBot(twitchio.Client):
""" """
print(f"DIAGNOSTIC: Initializing and connecting for user {self.db_user_id}...") print(f"DIAGNOSTIC: Initializing and connecting for user {self.db_user_id}...")
# Per twitchio documentation, the token must be prefixed with 'oauth:'.
formatted_token = f"oauth:{access_token}"
# The sensitive __init__ call is now inside the awaitable task. # The sensitive __init__ call is now inside the awaitable task.
super().__init__(token=formatted_token, client_id=client_id, client_secret=client_secret, super().__init__(token=access_token, client_id=client_id, client_secret=client_secret,
refresh_token=refresh_token, initial_channels=[channel_name], ssl=True) refresh_token=refresh_token, initial_channels=[channel_name], ssl=True)
self.channel_name = channel_name self.channel_name = channel_name
self.is_initialized = True self.is_initialized = True
await self.connect() await self.connect()
await self.join_channels([self.channel_name])
async def event_ready(self): async def event_ready(self):
"""Called once when the bot goes online.""" """Called once when the bot goes online."""