Detection/manager/builder_session.py
CHANGED
@@ -18,6 +18,7 @@ from pyrogram.errors import (
|
|
18 |
SessionPasswordNeeded
|
19 |
)
|
20 |
from pyrogram.types import (
|
|
|
21 |
InlineKeyboardMarkup,
|
22 |
InlineKeyboardButton
|
23 |
)
|
@@ -40,8 +41,64 @@ async def show_session(client, message):
|
|
40 |
await message.reply_text("β No found!")
|
41 |
return
|
42 |
session = user_data["user_client"][0]["session_string"]
|
43 |
-
await message.reply_text(
|
|
|
|
|
|
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
@Client.on_message(
|
46 |
filters.contact
|
47 |
& filters.private
|
|
|
18 |
SessionPasswordNeeded
|
19 |
)
|
20 |
from pyrogram.types import (
|
21 |
+
ReplyKeyboardRemove,
|
22 |
InlineKeyboardMarkup,
|
23 |
InlineKeyboardButton
|
24 |
)
|
|
|
41 |
await message.reply_text("β No found!")
|
42 |
return
|
43 |
session = user_data["user_client"][0]["session_string"]
|
44 |
+
await message.reply_text(
|
45 |
+
f"Show Session: <code>{session}</code>",
|
46 |
+
reply_markup=ReplyKeyboardRemove()
|
47 |
+
)
|
48 |
|
49 |
+
@Client.on_message(
|
50 |
+
filters.private
|
51 |
+
& filters.regex(r"^(Start Sessions)$")
|
52 |
+
)
|
53 |
+
async def start_session(client, message):
|
54 |
+
try:
|
55 |
+
confirm_sesi = await message.chat.ask(
|
56 |
+
"Please send your SESSION_STRING (from Create Detection):\n\n"
|
57 |
+
"Format should be: `asdfghkklxxxxx`\n\n"
|
58 |
+
"This not responding admins, You can try again issues\n"
|
59 |
+
"Type /cancel to abort",
|
60 |
+
timeout=300
|
61 |
+
)
|
62 |
+
except TimeoutError:
|
63 |
+
return await client.send_message(
|
64 |
+
message.chat.id, "`Time limit reached of 5 min.`"
|
65 |
+
)
|
66 |
+
if confirm_sesi.text.lower() == "/cancel":
|
67 |
+
return await client.send_message(message.chat.id, "Cancelled")
|
68 |
+
session = confirm_sesi.text
|
69 |
+
await confirm_sesi.delete()
|
70 |
+
now = dt.now().strftime("%Y-%m-%d %H:%M:%S")
|
71 |
+
admin_buttons = InlineKeyboardMarkup([
|
72 |
+
[InlineKeyboardButton("β
Approve", callback_data=f"approved_ub_{user_id}"),
|
73 |
+
InlineKeyboardButton("β Reject", callback_data=f"rejected_ub_{user_id}")],
|
74 |
+
[InlineKeyboardButton("π€ View User", url=f"tg://user?id={user_id}")]
|
75 |
+
])
|
76 |
+
existing_request = await db.users_detection.find_one({"user_client.session_string": session})
|
77 |
+
if existing_request:
|
78 |
+
await client.send_message(
|
79 |
+
message.chat.id,
|
80 |
+
f"β
**You already deployment Detection Request Submitted**\n\n"
|
81 |
+
f"β³ Admin approval usually takes <15 minutes",
|
82 |
+
reply_markup=InlineKeyboardMarkup([
|
83 |
+
[InlineKeyboardButton("π Check Status", callback_data=f"statusub_{user_id}")]
|
84 |
+
])
|
85 |
+
)
|
86 |
+
await client.send_message(
|
87 |
+
PRIVATE_GROUP_ID,
|
88 |
+
text=f"**Try again Detection Request**\n\n"
|
89 |
+
f"π€ User: {message.from_user.mention} (`{user_id}`)\n"
|
90 |
+
f"π Username: @{message.from_user.username}\n"
|
91 |
+
f"β° Submitted: {now}\n"
|
92 |
+
f"π· Tier: π Free",
|
93 |
+
reply_markup=admin_buttons
|
94 |
+
)
|
95 |
+
else:
|
96 |
+
await client.send_message(
|
97 |
+
message.chat.id,
|
98 |
+
"haven't found session yet, you want to try create detection",
|
99 |
+
reply_markup=ReplyKeyboardRemove()
|
100 |
+
)
|
101 |
+
|
102 |
@Client.on_message(
|
103 |
filters.contact
|
104 |
& filters.private
|