From 8e0c72e37ce6029e8d2b8e0b9769d7363b6a781f Mon Sep 17 00:00:00 2001 From: Nixer-2301 Date: Sat, 27 Jun 2026 13:57:09 +0800 Subject: [PATCH] Fix Bot.run startup on Python 3.14 when no current event loop exists --- khl/bot/bot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/khl/bot/bot.py b/khl/bot/bot.py index cc76b1d2..fe30c739 100644 --- a/khl/bot/bot.py +++ b/khl/bot/bot.py @@ -488,7 +488,11 @@ async def start(self): def run(self): """run the bot in blocking mode""" if not self.loop: - self.loop = asyncio.get_event_loop() + try: + self.loop = asyncio.get_event_loop() + except RuntimeError: + self.loop = asyncio.new_event_loop() + asyncio.set_event_loop(self.loop) try: self.loop.run_until_complete(self.start()) except KeyboardInterrupt: