File size: 32,203 Bytes
21bc372
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8252e98
21bc372
 
 
 
 
 
 
 
 
 
 
8252e98
21bc372
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d4f6273
21bc372
 
 
 
 
 
 
 
 
d4f6273
21bc372
 
 
 
 
 
d4f6273
21bc372
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
from datetime import datetime as dt, timedelta
import re
import uuid
import traceback
from pyrogram import Client
from pyrogram import Client as ren, filters
from pyrogram.types import *
from akn.utils.database import db as db_client
from config import PRIVATE_LOGS
from akn.utils.logger import LOGS

@ren.on_callback_query(filters.regex("^alldl_bot$"))
async def new_alldlbot_clone(bot: Client, cb: CallbackQuery):
    user_id = cb.from_user.id
    chat_id = cb.message.chat.id
    user_mention = cb.from_user.mention
    
    if await db_client.get_maintance():
        await cb.answer("🚧 Bot is under maintenance. Please try later.", show_alert=True)
        return await cb.message.edit_text("πŸ”§ Maintenance Mode\n\n@xpushz is working on updates...")
    
    try:
        await cb.message.delete()
        
        try:
            bot_token_ask = await cb.message.chat.ask(
                "πŸ€– Please send your bot token (from @BotFather):\n\n"
                "Format should be: `1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ`\n\n"
                "Type /cancel to abort",
                timeout=300
            )
        except TimeoutError:
            await bot.send_message(chat_id, "⏳ Session timed out after 5 minutes of inactivity.")
            return
        except Exception as e:
            LOGS.error(f"Error asking for bot token: {str(e)}")
            await bot.send_message(chat_id, "⚠️ error processing your request.")
            return

        if bot_token_ask.text.lower() == "/cancel":
            await bot.send_message(chat_id, "❌ Request cancelled")
            return

        bot_token = bot_token_ask.text.strip()
        await bot_token_ask.delete()

        if not re.match(r"^\d{9,11}:[a-zA-Z0-9_-]{35}$", bot_token):
            await bot.send_message(
                chat_id,
                "⚠️ Invalid bot token format!\n\n"
                "Please ensure:\n"
                "1. It's copied exactly from @BotFather\n"
                "2. Format is: `1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ`\n\n"
                "Try again or contact support if issues persist."
            )
            return

        existing_request = await db_client.alldl_bot.find_one({"user_id": user_id})
        
        replace_bot_id = bot_token.split(":")[0]
        token_exists = await db_client.alldl_bot.find_one(
            {"bots.bot_token": bot_token}
        )
        if token_exists:
            await bot.send_message(
                chat_id,
                "⚠️ This bot token is already registered in our system!\n\n"
                "Please create a new bot via @BotFather if you want to deploy another instance.",
                reply_markup=InlineKeyboardMarkup([
                    [InlineKeyboardButton("πŸ†• Create New Bot", url="https://t.me/BotFather")],
                    [InlineKeyboardButton("πŸ”„ Try Again", callback_data="alldl_bot")],
                    [InlineKeyboardButton("❌ Cancel", callback_data="customzie_bot")]
                ])
            )
            return

        if existing_request and not existing_request.get("is_premium", False):
            approved_bots = sum(1 for bot in existing_request.get("bots", []) if bot.get("status") == "approved")
            if approved_bots >= 1:
                await bot.send_message(
                    chat_id,
                    "⚠️ **Free Tier Limit Reached!**\n\n"
                    "πŸ”Ή Free users can deploy **1 bot maximum**\n"
                    "πŸ”Ή Premium users get **unlimited bots**\n\n"
                    "**Premium Features:**\n"
                    "βœ… Multiple simultaneous bots\n"
                    "βœ… Priority support\n"
                    "βœ… Advanced configurations",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("πŸ’Ž Upgrade to Premium", callback_data="premium_upgrades")],
                        [InlineKeyboardButton("πŸ“Š Manage Existing Bots", callback_data="my_bots")]
                    ])
                )
                return
        bot_uuid = str(uuid.uuid4())[:8]
        admin_buttons = InlineKeyboardMarkup([
            [InlineKeyboardButton("βœ… Approve", callback_data=f"approved_alldl_{user_id}_{bot_uuid}"),
             InlineKeyboardButton("❌ Reject",  callback_data=f"rejected_alldl_{user_id}_{bot_uuid}")],
            [InlineKeyboardButton("πŸ‘€ View User", url=f"tg://user?id={user_id}")]
        ])

        current_time = dt.now().strftime('%Y-%m-%d %H:%M:%S')
        bot_data = {
            "uuid": bot_uuid,
            "user_id": user_id,
            "bot_token": bot_token,
            "bot_id": int(replace_bot_id),
            "status": "pending",
            "is_active": False,
            "timestamp": current_time
        }

        if existing_request:
            await db_client.alldl_bot.update_one(
                {"user_id": user_id},
                {"$push": {"bots": bot_data},
                 "$set": {"last_updated": current_time, "bot_id": int(replace_bot_id)}},
                upsert=True
            )
            approved_count = sum(1 for bot in existing_request.get("bots", []) if bot.get("status") == "approved")
        else:
            await db_client.alldl_bot.insert_one({
                "user_id": user_id,
                "bot_id": int(replace_bot_id),
                "username": cb.from_user.username,
                "bots": [bot_data],
                "deployed_bots": 0,
                "is_premium": False,
                "created_at": current_time,
                "last_updated": current_time
            })
            approved_count = 0

        await bot.send_message(
            chat_id,
            f"βœ… **Deployment Request Submitted**\n\n"
            f"▫️ Current approved bots: {approved_count}\n"
            f"▫️ This will be bot #{approved_count + 1}\n\n"
            f"⏳ Admin approval usually takes <15 minutes\n\n"
            f"πŸ“Œ Token: `{bot_token[:10]}...`",
            reply_markup=InlineKeyboardMarkup([
                [InlineKeyboardButton("πŸ“Š Check Status", callback_data=f"statusdl_{user_id}")],
                [InlineKeyboardButton("πŸ†• Request Another", callback_data="customzie_bot")]
            ])
        )

        await bot.send_message(
            chat_id=PRIVATE_LOGS,
            text=f"πŸ“₯ **New AllDL Bot Request**\n\n"
                 f"πŸ‘€ User: {user_mention} (`{user_id}`)\n"
                 f"πŸ“› Username: @{cb.from_user.username}\n"
                 f"πŸ” Token: `{bot_token[:10]}...`\n"
                 f"⏰ Submitted: {current_time}\n"
                 f"🏷 Tier: {'πŸ’Ž Premium' if existing_request and existing_request.get('is_premium') else 'πŸ†“ Free'}",
            reply_markup=admin_buttons
        )

    except Exception as e:
        LOGS.error(f"AllDL Bot Request Error: {type(e).__name__} - {str(e)}")
        traceback.print_exc()
        await bot.send_message(
            chat_id,
            "⚠️ Please try again later.\n"
            "If this persists, contact @xpushz",
            reply_markup=InlineKeyboardMarkup([
                [InlineKeyboardButton("πŸ”„ Try Again", callback_data="alldl_bot")]
            ])
        )
        await bot.send_message(
            PRIVATE_LOGS,
            f"🚨 AllDL Bot Request Error\n\n"
            f"User: {user_mention} ({user_id})\n"
            f"Error: {type(e).__name__}\n"
            f"Details: {str(e)}"
        )

@ren.on_callback_query(filters.regex("^captcha_bot$"))
async def new_captcha_clone(bot: Client, cb: CallbackQuery):
    user_id = cb.from_user.id
    chat_id = cb.message.chat.id

    if await db_client.get_maintance():
        await cb.answer("🚧 Bot is under maintenance. Please try later.", show_alert=True)
        return await cb.message.edit_text("πŸ”§ Maintenance Mode\n\n@xpushz is working on updates...")
    try:
        await cb.message.delete()
        try:
           bot_token_ask = await cb.message.chat.ask(
                "πŸ€– Please send your bot token (from @BotFather):\n\n"
                "Format should be: `1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ`\n\n"
                "Type /cancel to abort",
                timeout=300
            )
        except TimeoutError:
            await bot.send_message(chat_id, "⏳ Timeout: No response received after 5 minutes")
            return

        if bot_token_ask.text.lower() == "/cancel":
            await bot.send_message(chat_id, "❌ Request cancelled")
            return

        bot_token = bot_token_ask.text.strip()
        await bot_token_ask.delete()

        if not re.match(r"^\d+:[a-zA-Z0-9_-]+$", bot_token):
            await bot.send_message(chat_id, "⚠️ Invalid bot token format!\nExample: `123456:ABC-DEF123xyz`")
            return

        existing_request = await db_client.captcha_bot.find_one({"user_id": user_id})

        admin_buttons = InlineKeyboardMarkup([
            [InlineKeyboardButton("βœ… Approve", callback_data=f"approve_capt_{user_id}"),
             InlineKeyboardButton("❌ Reject", callback_data=f"reject_capt_{user_id}")]
        ])
        if existing_request:
            if existing_request.get("status") == "approved":
                await bot.send_message(
                    chat_id,
                    "⚠️ You already have an approved bot!\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("❌ Back", callback_data="customzie_bot")]
                    ])
                )
                return
            if existing_request.get("status") == "rejected":
                await bot.send_message(
                    chat_id,
                    "⚠️ Your previous request was rejected!\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("❌ Back", callback_data="customzie_bot")]
                    ])
                )
                return
            if existing_request.get("status") == "pending":
                await bot.send_message(
                    chat_id=PRIVATE_LOGS,
                    text=f"πŸ“₯ New captcha Bot Request is Already\n\n"
                        f"πŸ‘€ User: {cb.from_user.mention} (`{user_id}`)\n"
                        f"πŸ†” Token: `{bot_token}`\n"
                        f"⏰ Submitted: {existing_request.get('timestamp', 'N/A')}",
                    reply_markup=admin_buttons,
                )
                await bot.send_message(
                    chat_id,
                    "⏳ Captcha: You already have a pending request!\n"
                    f"Submitted at: {existing_request.get('timestamp', 'N/A')}\n\n"
                    "Please wait for admin approval.\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("πŸ”„ Status Check", callback_data=f"statuscapt_{user_id}")]
                    ])
                )
                return
        await db_client.captcha_bot.update_one(
            {"user_id": user_id},
            {"$set": {
                "bot_token": bot_token,
                "status": "pending",
                "timestamp": dt.now().strftime('%Y-%m-%d %H:%M')
            }},
            upsert=True
        )
        await bot.send_message(
            chat_id=PRIVATE_LOGS,
            text=f"πŸ“₯ New Captcha Bot Request\n\n"
                 f"πŸ‘€ User: {cb.from_user.mention} (`{user_id}`)\n"
                 f"πŸ†” Token: `{bot_token}`\n"
                 f"⏰ Submitted: {dt.now().strftime('%Y-%m-%d %H:%M')}",
            reply_markup=admin_buttons,
        )
        await bot.send_message(
            chat_id,
            "βœ… Captcha: Request submitted successfully!\n\n"
            "Our admins will review your submission shortly.\n"
            "You'll receive a notification when processed.",
            reply_markup=InlineKeyboardMarkup([
                [InlineKeyboardButton("πŸ“Š Check Status", callback_data=f"statuscapt_{user_id}")]
            ])
        )
    except Exception as e:
        LOGS.error(f"captcha Bot Request Error: {str(e)}")
        traceback.print_exc()
        await bot.send_message(
            chat_id,
            "⚠️ Please try again later.\n"
            "If this persists, contact @xpushz",
        )
        await bot.send_message(PRIVATE_LOGS, f"Error: {type(e).__name__} - {str(e)}")

@ren.on_callback_query(filters.regex("^sesikntl$"))
async def new_sessionbot_clone(bot: Client, cb: CallbackQuery):
    user_id = cb.from_user.id
    chat_id = cb.message.chat.id

    if await db_client.get_maintance():
        await cb.answer("🚧 Bot is under maintenance. Please try later.", show_alert=True)
        return await cb.message.edit_text("πŸ”§ Maintenance Mode\n\n@xpushz is working on updates...")
    try:
        await cb.message.delete()
        try:
            bot_token_ask = await cb.message.chat.ask(
                "πŸ€– Please send your bot token (from @BotFather):\n\n"
                "Format should be: `1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ`\n\n"
                "Type /cancel to abort",
                timeout=300
            )
        except TimeoutError:
            await bot.send_message(chat_id, "⏳ Timeout: No response received after 5 minutes")
            return

        if bot_token_ask.text.lower() == "/cancel":
            await bot.send_message(chat_id, "❌ Request cancelled")
            return

        bot_token = bot_token_ask.text.strip()
        await bot_token_ask.delete()

        if not re.match(r"^\d+:[a-zA-Z0-9_-]+$", bot_token):
            await bot.send_message(chat_id, "⚠️ Invalid bot token format!\nExample: `123456:ABC-DEF123xyz`")
            return

        existing_request = await db_client.session_bot.find_one({"user_id": user_id})

        admin_buttons = InlineKeyboardMarkup([
            [InlineKeyboardButton("βœ… Approve", callback_data=f"approve_sesibot_{user_id}"),
             InlineKeyboardButton("❌ Reject", callback_data=f"reject_sesibot_{user_id}")]
        ])
        if existing_request:
            if existing_request.get("status") == "approved":
                await bot.send_message(
                    chat_id,
                    "⚠️ You already have an approved bot!\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("❌ Back", callback_data="customzie_bot")]
                    ])
                )
                return
            if existing_request.get("status") == "rejected":
                await bot.send_message(
                    chat_id,
                    "⚠️ Your previous request was rejected!\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("❌ Back", callback_data="customzie_bot")]
                    ])
                )
                return
            if existing_request.get("status") == "pending":
                await bot.send_message(
                    chat_id=PRIVATE_LOGS,
                    text=f"πŸ“₯ New Session Bot Request is Already\n\n"
                        f"πŸ‘€ User: {cb.from_user.mention} (`{user_id}`)\n"
                        f"πŸ†” Token: `{bot_token}`\n"
                        f"⏰ Submitted: {existing_request.get('timestamp', 'N/A')}",
                    reply_markup=admin_buttons,
                )
                await bot.send_message(
                    chat_id,
                    "⏳ SesiBot: You already have a pending request!\n"
                    f"Submitted at: {existing_request.get('timestamp', 'N/A')}\n\n"
                    "Please wait for admin approval.\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("πŸ”„ Status Check", callback_data=f"statussesi_{user_id}")]
                    ])
                )
                return
        await db_client.session_bot.update_one(
            {"user_id": user_id},
            {"$set": {
                "bot_token": bot_token,
                "status": "pending",
                "is_running": False,
                "timestamp": dt.now().strftime('%Y-%m-%d %H:%M')
            }},
            upsert=True
        )
        await bot.send_message(
            chat_id=PRIVATE_LOGS,
            text=f"πŸ“₯ New Session Bot Request\n\n"
                 f"πŸ‘€ User: {cb.from_user.mention} (`{user_id}`)\n"
                 f"πŸ†” Token: `{bot_token}`\n"
                 f"⏰ Submitted: {dt.now().strftime('%Y-%m-%d %H:%M')}",
            reply_markup=admin_buttons,
        )
        await bot.send_message(
            chat_id,
            "βœ… SesiBot: Request submitted successfully!\n\n"
            "Our admins will review your submission shortly.\n"
            "You'll receive a notification when processed.",
            reply_markup=InlineKeyboardMarkup([
                [InlineKeyboardButton("πŸ“Š Check Status", callback_data=f"statusnew_{user_id}")]
            ])
        )
    except Exception as e:
        LOGS.error(f"Session Bot Request Error: {str(e)}")
        traceback.print_exc()
        await bot.send_message(
            chat_id,
            "⚠️ Please try again later.\n"
            "If this persists, contact @xpushz",
        )
        await bot.send_message(PRIVATE_LOGS, f"Error: {type(e).__name__} - {str(e)}")

@ren.on_callback_query(filters.regex("^magic_font$"))
async def  new_magic_clone(bot: Client, cb: CallbackQuery):
    user_id = cb.from_user.id
    chat_id = cb.message.chat.id

    if await db_client.get_maintance():
        await cb.answer("🚧 Bot is under maintenance. Please try later.", show_alert=True)
        return await cb.message.edit_text("πŸ”§ Maintenance Mode\n\n@xpushz is working on updates...")
    try:
        await cb.message.delete()
        try:
            bot_token_ask = await cb.message.chat.ask(
                "πŸ€– Please send your bot token (from @BotFather):\n\n"
                "Format should be: `1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ`\n\n"
                "Type /cancel to abort",
                timeout=300
            )
        except TimeoutError:
            await bot.send_message(chat_id, "⏳ Timeout: No response received after 5 minutes")
            return

        if bot_token_ask.text.lower() == "/cancel":
            await bot.send_message(chat_id, "❌ Request cancelled")
            return

        bot_token = bot_token_ask.text.strip()
        await bot_token_ask.delete()

        if not re.match(r"^\d+:[a-zA-Z0-9_-]+$", bot_token):
            await bot.send_message(chat_id, "⚠️ Invalid bot token format!\nExample: `123456:ABC-DEF123xyz`")
            return

        existing_request = await db_client.magic_bot.find_one({"user_id": user_id})

        admin_buttons = InlineKeyboardMarkup([
            [InlineKeyboardButton("βœ… Approve", callback_data=f"approve_magicbot_{user_id}"),
             InlineKeyboardButton("❌ Reject", callback_data=f"reject_magicbot_{user_id}")]
        ])
        if existing_request:
            if existing_request.get("status") == "approved":
                await bot.send_message(
                    chat_id,
                    "⚠️ You already have an approved bot!\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("❌ Back", callback_data="customzie_bot")]
                    ])
                )
                return
            if existing_request.get("status") == "rejected":
                await bot.send_message(
                    chat_id,
                    "⚠️ Your previous request was rejected!\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("❌ Back", callback_data="customzie_bot")]
                    ])
                )
                return
            if existing_request.get("status") == "pending":
                await bot.send_message(
                    chat_id=PRIVATE_LOGS,
                    text=f"πŸ“₯ New Magic Fonts Bot Request is Already\n\n"
                        f"πŸ‘€ User: {cb.from_user.mention} (`{user_id}`)\n"
                        f"πŸ†” Token: `{bot_token}`\n"
                        f"⏰ Submitted: {existing_request.get('timestamp', 'N/A')}",
                    reply_markup=admin_buttons,
                )
                await bot.send_message(
                    chat_id,
                    "⏳ Magic: You already have a pending request!\n"
                    f"Submitted at: {existing_request.get('timestamp', 'N/A')}\n\n"
                    "Please wait for admin approval.\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("πŸ”„ Status Check", callback_data=f"statusmagic_{user_id}")]
                    ])
                )
                return
        await db_client.magic_bot.update_one(
            {"user_id": user_id},
            {"$set": {
                "bot_token": bot_token,
                "status": "pending",
                "timestamp": dt.now().strftime('%Y-%m-%d %H:%M')
            }},
            upsert=True
        )
        await bot.send_message(
            chat_id=PRIVATE_LOGS,
            text=f"πŸ“₯ New Magic Fonts Bot Request\n\n"
                 f"πŸ‘€ User: {cb.from_user.mention} (`{user_id}`)\n"
                 f"πŸ†” Token: `{bot_token}`\n"
                 f"⏰ Submitted: {dt.now().strftime('%Y-%m-%d %H:%M')}",
            reply_markup=admin_buttons,
        )
        await bot.send_message(
            chat_id,
            "βœ… Magic: Request submitted successfully!\n\n"
            "Our admins will review your submission shortly.\n"
            "You'll receive a notification when processed.",
            reply_markup=InlineKeyboardMarkup([
                [InlineKeyboardButton("πŸ“Š Check Status", callback_data=f"statusmagic_{user_id}")]
            ])
        )
    except Exception as e:
        LOGS.error(f"Magic Fonts Request Error: {str(e)}")
        traceback.print_exc()
        await bot.send_message(
            chat_id,
            "⚠️ Please try again later.\n"
            "If this persists, contact @xpushz",
        )
        await bot.send_message(PRIVATE_LOGS, f"Error: {type(e).__name__} - {str(e)}")

@ren.on_callback_query(filters.regex("^yt_bot$"))
async def new_youtube_clone(bot: Client, cb: CallbackQuery):
    user_id = cb.from_user.id
    chat_id = cb.message.chat.id

    if await db_client.get_maintance():
        await cb.answer("🚧 Bot is under maintenance. Please try later.", show_alert=True)
        return await cb.message.edit_text("πŸ”§ Maintenance Mode\n\n@xpushz is working on updates...")
    try:
        await cb.message.delete()
        try:
            bot_token_ask = await cb.message.chat.ask(
                "πŸ€– Please send your bot token (from @BotFather):\n\n"
                "Format should be: `1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ`\n\n"
                "Type /cancel to abort",
                timeout=300
            )
        except TimeoutError:
            await bot.send_message(chat_id, "⏳ Timeout: No response received after 5 minutes")
            return

        if bot_token_ask.text.lower() == "/cancel":
            await bot.send_message(chat_id, "❌ Request cancelled")
            return

        bot_token = bot_token_ask.text.strip()
        await bot_token_ask.delete()

        if not re.match(r"^\d+:[a-zA-Z0-9_-]+$", bot_token):
            await bot.send_message(chat_id, "⚠️ Invalid bot token format!\nExample: `123456:ABC-DEF123xyz`")
            return

        existing_request = await db_client.youtube_bot.find_one({"user_id": user_id})

        admin_buttons = InlineKeyboardMarkup([
            [InlineKeyboardButton("βœ… Approve", callback_data=f"approve_ytbot_{user_id}"),
             InlineKeyboardButton("❌ Reject", callback_data=f"reject_ytbot_{user_id}")]
        ])
        if existing_request:
            if existing_request.get("status") == "approved":
                await bot.send_message(
                    chat_id,
                    "⚠️ You already have an approved bot!\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("❌ Back", callback_data="customzie_bot")]
                    ])
                )
                return
            if existing_request.get("status") == "rejected":
                await bot.send_message(
                    chat_id,
                    "⚠️ Your previous request was rejected!\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("❌ Back", callback_data="customzie_bot")]
                    ])
                )
                return
            if existing_request.get("status") == "pending":
                await bot.send_message(
                    chat_id=PRIVATE_LOGS,
                    text=f"πŸ“₯ New Youtube Bot Request is Already\n\n"
                        f"πŸ‘€ User: {cb.from_user.mention} (`{user_id}`)\n"
                        f"πŸ†” Token: `{bot_token}`\n"
                        f"⏰ Submitted: {existing_request.get('timestamp', 'N/A')}",
                    reply_markup=admin_buttons,
                )
                await bot.send_message(
                    chat_id,
                    "⏳ Youtube: You already have a pending request!\n"
                    f"Submitted at: {existing_request.get('timestamp', 'N/A')}\n\n"
                    "Please wait for admin approval.\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("πŸ”„ Status Check", callback_data=f"statusyt_{user_id}")]
                    ])
                )
                return
        await db_client.youtube_bot.update_one(
            {"user_id": user_id},
            {"$set": {
                "bot_token": bot_token,
                "status": "pending",
                "timestamp": dt.now().strftime('%Y-%m-%d %H:%M')
            }},
            upsert=True
        )
        await bot.send_message(
            chat_id=PRIVATE_LOGS,
            text=f"πŸ“₯ New Youtube Bot Request\n\n"
                 f"πŸ‘€ User: {cb.from_user.mention} (`{user_id}`)\n"
                 f"πŸ†” Token: `{bot_token}`\n"
                 f"⏰ Submitted: {dt.now().strftime('%Y-%m-%d %H:%M')}",
            reply_markup=admin_buttons,
        )
        await bot.send_message(
            chat_id,
            "βœ… Youtube: Request submitted successfully!\n\n"
            "Our admins will review your submission shortly.\n"
            "You'll receive a notification when processed.",
            reply_markup=InlineKeyboardMarkup([
                [InlineKeyboardButton("πŸ“Š Check Status", callback_data=f"statusyt_{user_id}")]
            ])
        )
    except Exception as e:
        LOGS.error(f"Youtube Request Error: {str(e)}")
        traceback.print_exc()
        await bot.send_message(
            chat_id,
            "⚠️ Please try again later.\n"
            "If this persists, contact @xpushz",
        )
        await bot.send_message(PRIVATE_LOGS, f"Error: {type(e).__name__} - {str(e)}")

@ren.on_callback_query(filters.regex("^gemini_bot$"))
async def new_gemini_clone(bot: Client, cb: CallbackQuery):
    user_id = cb.from_user.id
    chat_id = cb.message.chat.id

    if await db_client.get_maintance():
        await cb.answer("🚧 Bot is under maintenance. Please try later.", show_alert=True)
        return await cb.message.edit_text("πŸ”§ Maintenance Mode\n\n@xpushz is working on updates...")
    try:
        await cb.message.delete()
        try:
            bot_token_ask = await cb.message.chat.ask(
                "πŸ€– Please send your bot token (from @BotFather):\n\n"
                "Format should be: `1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ`\n\n"
                "Type /cancel to abort",
                timeout=300
            )
        except TimeoutError:
            await bot.send_message(chat_id, "⏳ Timeout: No response received after 5 minutes")
            return

        if bot_token_ask.text.lower() == "/cancel":
            await bot.send_message(chat_id, "❌ Request cancelled")
            return

        bot_token = bot_token_ask.text.strip()
        await bot_token_ask.delete()

        if not re.match(r"^\d+:[a-zA-Z0-9_-]+$", bot_token):
            await bot.send_message(chat_id, "⚠️ Invalid bot token format!\nExample: `123456:ABC-DEF123xyz`")
            return

        existing_request = await db_client.gemini_bot.find_one({"user_id": user_id})

        admin_buttons = InlineKeyboardMarkup([
            [InlineKeyboardButton("βœ… Approve", callback_data=f"approve_geminibot_{user_id}"),
             InlineKeyboardButton("❌ Reject", callback_data=f"reject_geminibot_{user_id}")]
        ])
        if existing_request:
            if existing_request.get("status") == "approved":
                await bot.send_message(
                    chat_id,
                    "⚠️ You already have an approved bot!\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("❌ Back", callback_data="customzie_bot")]
                    ])
                )
                return
            if existing_request.get("status") == "rejected":
                await bot.send_message(
                    chat_id,
                    "⚠️ Your previous request was rejected!\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("❌ Back", callback_data="customzie_bot")]
                    ])
                )
                return
            if existing_request.get("status") == "pending":
                await bot.send_message(
                    chat_id=PRIVATE_LOGS,
                    text=f"πŸ“₯ New Gemini Bot Request is Already\n\n"
                        f"πŸ‘€ User: {cb.from_user.mention} (`{user_id}`)\n"
                        f"πŸ†” Token: `{bot_token}`\n"
                        f"⏰ Submitted: {existing_request.get('timestamp', 'N/A')}",
                    reply_markup=admin_buttons,
                )
                await bot.send_message(
                    chat_id,
                    "⏳ Gemini: You already have a pending request!\n"
                    f"Submitted at: {existing_request.get('timestamp', 'N/A')}\n\n"
                    "Please wait for admin approval.\n",
                    reply_markup=InlineKeyboardMarkup([
                        [InlineKeyboardButton("πŸ”„ Status Check", callback_data=f"statusgm_{user_id}")]
                    ])
                )
                return
        await db_client.gemini_bot.update_one(
            {"user_id": user_id},
            {"$set": {
                "bot_token": bot_token,
                "status": "pending",
                "timestamp": dt.now().strftime('%Y-%m-%d %H:%M')
            }},
            upsert=True
        )
        await bot.send_message(
            chat_id=PRIVATE_LOGS,
            text=f"πŸ“₯ New Gemini Bot Request\n\n"
                 f"πŸ‘€ User: {cb.from_user.mention} (`{user_id}`)\n"
                 f"πŸ†” Token: `{bot_token}`\n"
                 f"⏰ Submitted: {dt.now().strftime('%Y-%m-%d %H:%M')}",
            reply_markup=admin_buttons,
        )
        await bot.send_message(
            chat_id,
            "βœ… Gemini: Request submitted successfully!\n\n"
            "Our admins will review your submission shortly.\n"
            "You'll receive a notification when processed.",
            reply_markup=InlineKeyboardMarkup([
                [InlineKeyboardButton("πŸ“Š Check Status", callback_data=f"statusgm_{user_id}")]
            ])
        )
    except Exception as e:
        LOGS.error(f"Gemini Request Error: {str(e)}")
        traceback.print_exc()
        await bot.send_message(
            chat_id,
            "⚠️ Please try again later.\n"
            "If this persists, contact @xpushz",
        )
        await bot.send_message(PRIVATE_LOGS, f"Error: {type(e).__name__} - {str(e)}")