Adding twitchio port 8123

This commit is contained in:
2025-11-17 15:47:23 +01:00
parent d1c4c931ef
commit 6b2d296774

View File

@@ -1,8 +1,14 @@
from twitchio.ext import commands from twitchio.ext import commands
from twitchio.web import AiohttpAdapter
class TwitchBot(commands.Bot): class TwitchBot(commands.Bot):
def __init__(self, access_token: str, client_id: str, client_secret: str, bot_id: str, channel_name: str, websocket_manager): 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 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__( super().__init__(
token=access_token, token=access_token,
prefix='!', # A prefix is required but won't be used for reading chat 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 # The 'bot_id' is the Twitch ID of the user account the bot is running as
bot_id=bot_id, id=bot_id, bot_id=bot_id, id=bot_id,
# Explicitly disable the internal web server to prevent port conflicts # Explicitly disable the internal web server to prevent port conflicts
eventsub_url=None, # Pass our custom-configured adapter.
# Ensure no web adapter is initialized web_server_adapter=adapter
web_adapter=None
) )
self.channel_name = channel_name self.channel_name = channel_name