Update Akeno/__main__.py
Browse files- Akeno/__main__.py +22 -10
Akeno/__main__.py
CHANGED
@@ -29,8 +29,8 @@ from pyrogram.errors import *
|
|
29 |
from uvloop import install
|
30 |
|
31 |
from Akeno import aiohttpsession, clients
|
32 |
-
from Akeno.utils.logger import LOGS
|
33 |
from Akeno.utils.database import db
|
|
|
34 |
|
35 |
logging.basicConfig(level=logging.INFO)
|
36 |
logging.getLogger("pyrogram.syncer").setLevel(logging.WARNING)
|
@@ -43,18 +43,30 @@ async def main():
|
|
43 |
for cli in clients:
|
44 |
try:
|
45 |
await cli.start()
|
46 |
-
|
47 |
-
LOGS.info(f"
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
await cli.join_chat("RendyProjects")
|
50 |
except UserIsBlocked:
|
51 |
-
LOGS.
|
52 |
-
return
|
53 |
-
except Exception as e:
|
54 |
-
LOGS.error(f"Error starting userbot: {e}")
|
55 |
await idle()
|
56 |
except Exception as e:
|
57 |
-
LOGS.
|
58 |
finally:
|
59 |
await asyncio.gather(
|
60 |
aiohttpsession.close()
|
@@ -69,4 +81,4 @@ if __name__ == "__main__":
|
|
69 |
with closing(loop):
|
70 |
with suppress(asyncio.exceptions.CancelledError):
|
71 |
loop.run_until_complete(main())
|
72 |
-
loop.run_until_complete(asyncio.sleep(3.0))
|
|
|
29 |
from uvloop import install
|
30 |
|
31 |
from Akeno import aiohttpsession, clients
|
|
|
32 |
from Akeno.utils.database import db
|
33 |
+
from Akeno.utils.logger import LOGS
|
34 |
|
35 |
logging.basicConfig(level=logging.INFO)
|
36 |
logging.getLogger("pyrogram.syncer").setLevel(logging.WARNING)
|
|
|
43 |
for cli in clients:
|
44 |
try:
|
45 |
await cli.start()
|
46 |
+
except SessionExpired as e:
|
47 |
+
LOGS.info(f"Error {e}")
|
48 |
+
sys.exit(1)
|
49 |
+
except ApiIdInvalid as e:
|
50 |
+
LOGS.info(f"Error {e}")
|
51 |
+
sys.exit(1)
|
52 |
+
except UserDeactivated as e:
|
53 |
+
LOGS.info(f"Error {e}")
|
54 |
+
sys.exit(1)
|
55 |
+
except AuthKeyDuplicated as e:
|
56 |
+
LOGS.info(f"Error {e}")
|
57 |
+
sys.exit(1)
|
58 |
+
except Exception as e:
|
59 |
+
LOGS.info(f"Error starting userbot: {e}")
|
60 |
+
ex = await cli.get_me()
|
61 |
+
LOGS.info(f"Started {ex.first_name}")
|
62 |
+
await cli.send_message("me", "Starting Akeno Userbot")
|
63 |
+
try:
|
64 |
await cli.join_chat("RendyProjects")
|
65 |
except UserIsBlocked:
|
66 |
+
return LOGS.info("You have been blocked. Please support @xtdevs")
|
|
|
|
|
|
|
67 |
await idle()
|
68 |
except Exception as e:
|
69 |
+
LOGS.info(f"Error in main: {e}")
|
70 |
finally:
|
71 |
await asyncio.gather(
|
72 |
aiohttpsession.close()
|
|
|
81 |
with closing(loop):
|
82 |
with suppress(asyncio.exceptions.CancelledError):
|
83 |
loop.run_until_complete(main())
|
84 |
+
loop.run_until_complete(asyncio.sleep(3.0))
|