edrsfx
This commit is contained in:
@@ -25,6 +25,9 @@ class TwitchBot(twitchio.Client):
|
|||||||
ssl=True # Mandate: Explicitly use SSL for the IRC connection.
|
ssl=True # Mandate: Explicitly use SSL for the IRC connection.
|
||||||
)
|
)
|
||||||
self.channel_name = channel_name
|
self.channel_name = channel_name
|
||||||
|
# Health Check: If __init__ completes successfully, this flag will exist.
|
||||||
|
# If super().__init__ fails silently, this line is never reached.
|
||||||
|
self.is_initialized = True
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -42,6 +42,11 @@ class ListenerManager:
|
|||||||
db_user_id=user.id
|
db_user_id=user.id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Verify that the bot was initialized correctly before proceeding.
|
||||||
|
# This catches silent failures from the twitchio library.
|
||||||
|
if not getattr(bot, 'is_initialized', False):
|
||||||
|
raise Exception("TwitchBot failed to initialize, likely due to an invalid token.")
|
||||||
|
|
||||||
task = asyncio.create_task(bot.start())
|
task = asyncio.create_task(bot.start())
|
||||||
# Store both the task and the bot instance for graceful shutdown
|
# Store both the task and the bot instance for graceful shutdown
|
||||||
self.active_listeners[user.id] = {"task": task, "bot": bot}
|
self.active_listeners[user.id] = {"task": task, "bot": bot}
|
||||||
|
|||||||
Reference in New Issue
Block a user