randydev commited on
Commit
59136f0
Β·
verified Β·
1 Parent(s): 44e0e9d
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(f"Show Session: <spoiler>{session}</spoiler>")
 
 
 
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