From 8abb76a55bff1ead293bb0ca39cd16967cfa0cb9 Mon Sep 17 00:00:00 2001 From: ramforth Date: Tue, 18 Nov 2025 01:14:42 +0100 Subject: [PATCH] Later bot start --- chat_listener.py | 9 --------- listener_manager.py | 4 +++- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/chat_listener.py b/chat_listener.py index 5e7ef90..bf52071 100644 --- a/chat_listener.py +++ b/chat_listener.py @@ -14,22 +14,13 @@ class TwitchBot(commands.Bot): # Store our application's database user ID to avoid conflict with twitchio's internal 'owner_id' self.db_user_id = db_user_id - # Force the bot to use our dummy adapter that does nothing. - # This is the definitive fix to prevent any port conflicts. - adapter = NullAdapter() - super().__init__( token=access_token, - # Mandate: Explicitly disable the internal web server. - web_server_adapter=adapter, - eventsub_url=None, prefix='!', # A prefix is required but won't be used for reading chat initial_channels=[channel_name], # These are required by twitchio client_id=client_id, client_secret=client_secret, - # The 'bot_id' is NOT a valid parameter for the parent commands.Bot class. - # Its presence was causing our web_server_adapter to be ignored. ssl=True # Mandate: Explicitly use SSL for the IRC connection. ) self.channel_name = channel_name diff --git a/listener_manager.py b/listener_manager.py index 41b376f..8655545 100644 --- a/listener_manager.py +++ b/listener_manager.py @@ -33,7 +33,9 @@ class ListenerManager: websocket_manager=websocket_manager, db_user_id=user.id ) - task = asyncio.create_task(bot.start()) + # The `web_server=False` argument is the most direct way to prevent + # twitchio from attempting to start its own web server. + task = asyncio.create_task(bot.start(web_server=False)) self.active_listeners[user.id] = task async def stop_listener_for_user(self, user_id: int):