diff --git a/chat_listener.py b/chat_listener.py index dbd7fc1..c440c57 100644 --- a/chat_listener.py +++ b/chat_listener.py @@ -1,8 +1,14 @@ from twitchio.ext import commands +from twitchio.web import AiohttpAdapter class TwitchBot(commands.Bot): def __init__(self, access_token: str, client_id: str, client_secret: str, bot_id: str, channel_name: str, websocket_manager): self.websocket_manager = websocket_manager + + # Configure the internal web adapter to use a non-standard, high port + # to avoid conflicts during development and hot-reloading. + adapter = AiohttpAdapter(host="localhost", port=8123) + super().__init__( token=access_token, prefix='!', # A prefix is required but won't be used for reading chat @@ -13,9 +19,8 @@ class TwitchBot(commands.Bot): # The 'bot_id' is the Twitch ID of the user account the bot is running as bot_id=bot_id, id=bot_id, # Explicitly disable the internal web server to prevent port conflicts - eventsub_url=None, - # Ensure no web adapter is initialized - web_adapter=None + # Pass our custom-configured adapter. + web_server_adapter=adapter ) self.channel_name = channel_name