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