From cc24b3c740c802ec68c5cffbdf8c00aaac4de7f8 Mon Sep 17 00:00:00 2001 From: Profitroll <47523801+profitrollgame@users.noreply.github.com> Date: Sun, 14 May 2023 21:27:07 +0200 Subject: [PATCH] Changed main structure --- main.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index e1563d8..1c7e175 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,6 @@ -import asyncio import logging from os import getpid -from pyrogram.sync import idle - from modules.app import PyroClient logging.basicConfig( @@ -22,21 +19,17 @@ except ImportError: pass -async def main(): +def main(): client = PyroClient() try: - await client.start() - await idle() + client.run() except KeyboardInterrupt: logger.warning(f"Forcefully shutting down with PID {getpid()}...") finally: - await client.stop() + client.__exit__() + exit() if __name__ == "__main__": - event_policy = asyncio.get_event_loop_policy() - event_loop = event_policy.new_event_loop() - asyncio.set_event_loop(event_loop) - event_loop.run_until_complete(main()) - event_loop.close() + main() \ No newline at end of file