Exception
Browse files- akn/manage/approve_params.py +21 -5
akn/manage/approve_params.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
import time
|
2 |
from datetime import datetime as dt, timedelta
|
|
|
3 |
from pyrogram import *
|
4 |
-
from pyrogram import Client as ren, filters
|
5 |
from pyrogram.types import *
|
|
|
6 |
from akn.utils.database import db as db_client
|
7 |
from akn.utils.logger import LOGS
|
8 |
from akn.manage.new_start_funcs import initial_client_bots, initial_client_user
|
@@ -103,10 +104,25 @@ async def handle_approvalub(client, callback, request, user_id, admin_id, admin_
|
|
103 |
try:
|
104 |
string_session = request["user_client"][0]["session_string"]
|
105 |
user_bots = initial_client_user(string_session)
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
global storage_running
|
111 |
storage_running[user_id] = user_bots
|
112 |
|
|
|
1 |
import time
|
2 |
from datetime import datetime as dt, timedelta
|
3 |
+
from pyrogram import Client as ren
|
4 |
from pyrogram import *
|
|
|
5 |
from pyrogram.types import *
|
6 |
+
from pyrogram.errors import *
|
7 |
from akn.utils.database import db as db_client
|
8 |
from akn.utils.logger import LOGS
|
9 |
from akn.manage.new_start_funcs import initial_client_bots, initial_client_user
|
|
|
104 |
try:
|
105 |
string_session = request["user_client"][0]["session_string"]
|
106 |
user_bots = initial_client_user(string_session)
|
107 |
+
try:
|
108 |
+
await user_bots.start()
|
109 |
+
bot_user = await user_bots.get_me()
|
110 |
+
except AuthKeyUnregistered as e:
|
111 |
+
await client.send_message(
|
112 |
+
-1002407639480,
|
113 |
+
f"Error reason: AuthKeyUnregistered `{user_id}`"
|
114 |
+
)
|
115 |
+
await client.send_message(user_id, "Error reason: AuthKeyUnregistered")
|
116 |
+
return
|
117 |
+
except Exception as e:
|
118 |
+
LOGS.error(f"Error handle_approvalub: {str(e)}")
|
119 |
+
await client.send_message(
|
120 |
+
user_id,
|
121 |
+
"⚠️ Userbot approval failed due to technical reasons.\n"
|
122 |
+
"Our team has been notified. Please try again later."
|
123 |
+
)
|
124 |
+
return
|
125 |
+
|
126 |
global storage_running
|
127 |
storage_running[user_id] = user_bots
|
128 |
|