Skip to content

Commit 478b52d

Browse files
authored
patch
1 parent 746a920 commit 478b52d

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

Thunder/__main__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
import sys
77
from datetime import datetime
88

9-
from uvloop import install
109
from pathlib import Path
1110

12-
install()
11+
import uvloop
12+
uvloop.install()
13+
asyncio.set_event_loop(asyncio.new_event_loop())
14+
1315
from aiohttp import web
1416
from pyrogram import idle
1517

@@ -250,14 +252,11 @@ async def schedule_token_cleanup():
250252
logger.error(f"Token cleanup error: {e}", exc_info=True)
251253

252254
if __name__ == '__main__':
253-
loop = asyncio.get_event_loop()
254255
try:
255-
loop.run_until_complete(start_services())
256+
asyncio.run(start_services())
256257
except KeyboardInterrupt:
257258
print("╔═══════════════════════════════════════════════════════════╗")
258259
print("║ Bot stopped by user (CTRL+C) ║")
259260
print("╚═══════════════════════════════════════════════════════════╝")
260261
except Exception as e:
261262
logger.error(f"An unexpected error occurred: {e}")
262-
finally:
263-
loop.close()

0 commit comments

Comments
 (0)