From af86ba9a8e93325a8418c39df08b16a9dcf74fde Mon Sep 17 00:00:00 2001 From: Mow910 Date: Tue, 10 Mar 2026 20:11:13 +0100 Subject: [PATCH] Refactor TwitchBot event loop management by replacing `get_event_loop` with `get_running_loop` for improved compatibility with asynchronous operations. This change enhances the bot's readiness handling and ensures consistent event loop usage. --- twitchbot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twitchbot/__init__.py b/twitchbot/__init__.py index 8cf3af8..c486b1a 100644 --- a/twitchbot/__init__.py +++ b/twitchbot/__init__.py @@ -44,6 +44,7 @@ USER_SCOPE = [ async def _onReady(ready_event: EventData): logging.info('Bot Twitch prĂȘt') + twitchBot._loop = asyncio.get_running_loop() with webapp.app_context(): channel = ConfigurationHelper().getValue('twitch_channel') webapp.config["BOT_STATUS"]["twitch_connected"] = True @@ -161,7 +162,6 @@ class TwitchBot(): _loop = None async def _connect(self): - self._loop = asyncio.get_event_loop() with webapp.app_context(): if _isConfigured(): try: