forked from Learningbots79/movies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpm_filter.py
1662 lines (1561 loc) · 88.3 KB
/
pm_filter.py
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
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import asyncio
import re
import math
from pyrogram.errors.exceptions.bad_request_400 import MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty
from Script import script
import pyrogram
from info import * #SUBSCRIPTION, PAYPICS, START_IMG, SETTINGS, URL, STICKERS_IDS,PREMIUM_POINT,MAX_BTN, BIN_CHANNEL, USERNAME, URL, ADMINS,REACTIONS, LANGUAGES, QUALITIES, YEARS, SEASONS, AUTH_CHANNEL, SUPPORT_GROUP, IMDB, IMDB_TEMPLATE, LOG_CHANNEL, LOG_VR_CHANNEL, TUTORIAL, FILE_CAPTION, SHORTENER_WEBSITE, SHORTENER_API, SHORTENER_WEBSITE2, SHORTENER_API2, DELETE_TIME
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery, InputMediaPhoto, ChatPermissions, WebAppInfo, InputMediaAnimation, InputMediaPhoto
from pyrogram import Client, filters, enums
from pyrogram.errors import * #FloodWait, UserIsBlocked, MessageNotModified, PeerIdInvalid, ChatAdminRequired
from utils import temp, get_settings, is_check_admin, get_status, get_size, save_group_settings, is_req_subscribed, get_poster, get_status, get_readable_time , imdb , formate_file_name
from database.users_chats_db import db
from database.ia_filterdb import Media, get_search_results, get_bad_files, get_file_details
import random
lock = asyncio.Lock()
from .Extra.checkFsub import is_user_fsub
import traceback
from fuzzywuzzy import process
BUTTONS = {}
FILES_ID = {}
CAP = {}
# zishan [
from database.jsreferdb import referdb
from database.config_db import mdb
import logging
from urllib.parse import quote_plus
from Jisshu.util.file_properties import get_name, get_hash, get_media_file_size
logger = logging.getLogger(__name__)
logger.setLevel(logging.ERROR)
# ] codes add
@Client.on_message(filters.private & filters.text & filters.incoming)
async def pm_search(client, message):
await mdb.update_top_messages(message.from_user.id, message.text)
bot_id = client.me.id
user_id = message.from_user.id
# if user_id in ADMINS: return
if str(message.text).startswith('/'):
return
if await db.get_pm_search_status(bot_id):
if 'hindi' in message.text.lower() or 'tamil' in message.text.lower() or 'telugu' in message.text.lower() or 'malayalam' in message.text.lower() or 'kannada' in message.text.lower() or 'english' in message.text.lower() or 'gujarati' in message.text.lower():
return await auto_filter(client, message)
await auto_filter(client, message)
else:
await message.reply_text("<b><i>ɪ ᴀᴍ ɴᴏᴛ ᴡᴏʀᴋɪɴɢ ʜᴇʀᴇ. ꜱᴇᴀʀᴄʜ ᴍᴏᴠɪᴇꜱ ɪɴ ᴏᴜʀ ᴍᴏᴠɪᴇ ꜱᴇᴀʀᴄʜ ɢʀᴏᴜᴘ.</i></b>",
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("📝 ᴍᴏᴠɪᴇ ꜱᴇᴀʀᴄʜ ɢʀᴏᴜᴘ ", url=f'https://t.me/learning_bots')]]))
@Client.on_message(filters.group & filters.text & filters.incoming)
async def group_search(client, message):
#await message.react(emoji=random.choice(REACTIONS))
await mdb.update_top_messages(message.from_user.id, message.text)
user_id = message.from_user.id if message.from_user else None
chat_id = message.chat.id
settings = await get_settings(chat_id)
# ifJoinedFsub = await is_user_fsub(client,message)
#if ifJoinedFsub == False:
# return
if message.chat.id == SUPPORT_GROUP :
if message.text.startswith("/"):
return
files, n_offset, total = await get_search_results(message.text, offset=0)
if total != 0:
link = await db.get_set_grp_links(index=1)
msg = await message.reply_text(script.SUPPORT_GRP_MOVIE_TEXT.format(message.from_user.mention() , total) , reply_markup=InlineKeyboardMarkup([
[ InlineKeyboardButton('ɢᴇᴛ ғɪʟᴇs ғʀᴏᴍ ʜᴇʀᴇ 😉' , url=link)]
]))
await asyncio.sleep(300)
return await msg.delete()
else: return
if settings["auto_filter"]:
if not user_id:
#await message.reply("<b>🚨 ɪ'ᴍ ɴᴏᴛ ᴡᴏʀᴋɪɴɢ ғᴏʀ ᴀɴᴏɴʏᴍᴏᴜꜱ ᴀᴅᴍɪɴ!</b>")
return
if 'hindi' in message.text.lower() or 'tamil' in message.text.lower() or 'telugu' in message.text.lower() or 'malayalam' in message.text.lower() or 'kannada' in message.text.lower() or 'english' in message.text.lower() or 'gujarati' in message.text.lower():
return await auto_filter(client, message)
elif message.text.startswith("/"):
return
elif re.findall(r'https?://\S+|www\.\S+|t\.me/\S+', message.text):
if await is_check_admin(client, message.chat.id, message.from_user.id):
return
await message.delete()
return await message.reply("<b>sᴇɴᴅɪɴɢ ʟɪɴᴋ ɪsɴ'ᴛ ᴀʟʟᴏᴡᴇᴅ ʜᴇʀᴇ ❌🤞🏻</b>")
elif '@admin' in message.text.lower() or '@admins' in message.text.lower():
if await is_check_admin(client, message.chat.id, message.from_user.id):
return
admins = []
async for member in client.get_chat_members(chat_id=message.chat.id, filter=enums.ChatMembersFilter.ADMINISTRATORS):
if not member.user.is_bot:
admins.append(member.user.id)
if member.status == enums.ChatMemberStatus.OWNER:
if message.reply_to_message:
try:
sent_msg = await message.reply_to_message.forward(member.user.id)
await sent_msg.reply_text(f"#Attention\n★ User: {message.from_user.mention}\n★ Group: {message.chat.title}\n\n★ <a href={message.reply_to_message.link}>Go to message</a>", disable_web_page_preview=True)
except:
pass
else:
try:
sent_msg = await message.forward(member.user.id)
await sent_msg.reply_text(f"#Attention\n★ User: {message.from_user.mention}\n★ Group: {message.chat.title}\n\n★ <a href={message.link}>Go to message</a>", disable_web_page_preview=True)
except:
pass
hidden_mentions = (f'[\u2064](tg://user?id={user_id})' for user_id in admins)
await message.reply_text('<code>Report sent</code>' + ''.join(hidden_mentions))
return
else:
try:
await auto_filter(client, message)
except Exception as e:
traceback.print_exc()
print('found err in grp search :',e)
else:
k=await message.reply_text('<b>⚠️ ᴀᴜᴛᴏ ꜰɪʟᴛᴇʀ ᴍᴏᴅᴇ ɪꜱ ᴏғғ...</b>')
await asyncio.sleep(10)
await k.delete()
try:
await message.delete()
except:
pass
@Client.on_callback_query(filters.regex(r"^reffff"))
async def refercall(bot, query):
btn = [[
InlineKeyboardButton('invite link', url=f'https://telegram.me/share/url?url=https://t.me/{bot.me.username}?start=reff_{query.from_user.id}&text=Hello%21%20Experience%20a%20bot%20that%20offers%20a%20vast%20library%20of%20unlimited%20movies%20and%20series.%20%F0%9F%98%83'),
InlineKeyboardButton(f'⏳ {referdb.get_refer_points(query.from_user.id)}', callback_data='ref_point'),
InlineKeyboardButton('Back', callback_data='start')
]]
reply_markup = InlineKeyboardMarkup(btn)
await bot.send_photo(
chat_id=query.message.chat.id,
photo="https://graph.org/file/1a2e64aee3d4d10edd930.jpg",
caption=f'Hay Your refer link:\n\nhttps://t.me/{bot.me.username}?start=reff_{query.from_user.id}\n\nShare this link with your friends, Each time they join, you will get 10 referral points and after 100 points you will get 1 month premium subscription.',
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
await query.answer()
@Client.on_callback_query(filters.regex(r"^next"))
async def next_page(bot, query):
ident, req, key, offset = query.data.split("_")
if int(req) not in [query.from_user.id, 0]:
return await query.answer(script.ALRT_TXT.format(query.from_user.first_name), show_alert=True)
try:
offset = int(offset)
except:
offset = 0
search = BUTTONS.get(key)
cap = CAP.get(key)
if not search:
await query.answer(script.OLD_ALRT_TXT.format(query.from_user.first_name),show_alert=True)
return
files, n_offset, total = await get_search_results(search, offset=offset)
try:
n_offset = int(n_offset)
except:
n_offset = 0
if not files:
return
temp.FILES_ID[key] = files
batch_ids = files
temp.FILES_ID[f"{query.message.chat.id}-{query.id}"] = batch_ids
batch_link = f"batchfiles#{query.message.chat.id}#{query.id}#{query.from_user.id}"
ads, ads_name, _ = await mdb.get_advirtisment()
ads_text = ""
if ads is not None and ads_name is not None:
ads_url = f"https://t.me/{temp.U_NAME}?start=ads"
ads_text = f"<a href={ads_url}>{ads_name}</a>"
js_ads = f"\n━━━━━━━━━━━━━━━━━━\n <b>{ads_text}</b> \n━━━━━━━━━━━━━━━━━━" if ads_text else ""
settings = await get_settings(query.message.chat.id)
reqnxt = query.from_user.id if query.from_user else 0
temp.CHAT[query.from_user.id] = query.message.chat.id
#del_msg = f"\n\n<b>⚠️ ᴛʜɪs ᴍᴇssᴀɢᴇ ᴡɪʟʟ ʙᴇ ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀꜰᴛᴇʀ <code>{get_readable_time(DELETE_TIME)}</code> ᴛᴏ ᴀᴠᴏɪᴅ ᴄᴏᴘʏʀɪɢʜᴛ ɪssᴜᴇs</b>" if settings["auto_delete"] else ''
links = ""
if settings["link"]:
btn = []
for file_num, file in enumerate(files, start=offset+1):
links += f"""<b>\n\n{file_num}. <a href=https://t.me/{temp.U_NAME}?start=file_{query.message.chat.id}_{file.file_id}>[{get_size(file.file_size)}] {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}</a></b>"""
else:
btn = [[InlineKeyboardButton(text=f"📁 {get_size(file.file_size)}≽ {formate_file_name(file.file_name)}", url=f'https://telegram.dog/{temp.U_NAME}?start=file_{query.message.chat.id}_{file.file_id}'),]
for file in files
]
btn.insert(0,[
InlineKeyboardButton("📥 𝗦𝗲𝗻𝗱 𝗔𝗹𝗹 𝗙𝗶𝗹𝗲𝘀 📥", callback_data=batch_link),
])
btn.insert(1, [
InlineKeyboardButton("ǫᴜᴀʟɪᴛʏ ", callback_data=f"qualities#{key}#{offset}#{req}"),
InlineKeyboardButton("ꜱᴇᴀꜱᴏɴ", callback_data=f"seasons#{key}#{offset}#{req}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ ", callback_data=f"languages#{key}#{offset}#{req}")
])
if 0 < offset <= int(MAX_BTN):
off_set = 0
elif offset == 0:
off_set = None
else:
off_set = offset - int(MAX_BTN)
if n_offset == 0:
btn.append(
[InlineKeyboardButton("⪻ ʙᴀᴄᴋ", callback_data=f"next_{req}_{key}_{off_set}"),
InlineKeyboardButton(f"ᴘᴀɢᴇ {math.ceil(int(offset) / int(MAX_BTN)) + 1} / {math.ceil(total / int(MAX_BTN))}", callback_data="pages")]
)
elif off_set is None:
btn.append(
[InlineKeyboardButton(f"{math.ceil(int(offset) / int(MAX_BTN)) + 1} / {math.ceil(total / int(MAX_BTN))}", callback_data="pages"),
InlineKeyboardButton("ɴᴇxᴛ ⪼", callback_data=f"next_{req}_{key}_{n_offset}")])
else:
btn.append(
[
InlineKeyboardButton("⪻ ʙᴀᴄᴋ", callback_data=f"next_{req}_{key}_{off_set}"),
InlineKeyboardButton(f"{math.ceil(int(offset) / int(MAX_BTN)) + 1} / {math.ceil(total / int(MAX_BTN))}", callback_data="pages"),
InlineKeyboardButton("ɴᴇxᴛ ⪼", callback_data=f"next_{req}_{key}_{n_offset}")
],
)
if settings["link"]:
links = ""
for file_num, file in enumerate(files, start=offset+1):
links += f"""<b>\n\n{file_num}. <a href=https://t.me/{temp.U_NAME}?start=file_{query.message.chat.id}_{file.file_id}>[{get_size(file.file_size)}] {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}</a></b>"""
await query.message.edit_text(cap + links + js_ads, disable_web_page_preview=True, parse_mode=enums.ParseMode.HTML, reply_markup=InlineKeyboardMarkup(btn))
return
try:
await query.edit_message_reply_markup(
reply_markup=InlineKeyboardMarkup(btn)
)
except MessageNotModified:
pass
await query.answer()
@Client.on_callback_query(filters.regex(r"^seasons#"))
async def seasons_cb_handler(client: Client, query: CallbackQuery):
_, key, offset, req = query.data.split("#")
if int(req) != query.from_user.id:
return await query.answer(script.ALRT_TXT, show_alert=True)
btn= []
for i in range(0, len(SEASONS)-1, 3):
btn.append([
InlineKeyboardButton(
text=SEASONS[i].title(),
callback_data=f"season_search#{SEASONS[i].lower()}#{key}#0#{offset}#{req}"
),
InlineKeyboardButton(
text=SEASONS[i+1].title(),
callback_data=f"season_search#{SEASONS[i+1].lower()}#{key}#0#{offset}#{req}"
),
InlineKeyboardButton(
text=SEASONS[i+2].title(),
callback_data=f"season_search#{SEASONS[i+2].lower()}#{key}#0#{offset}#{req}"
),
])
btn.append([InlineKeyboardButton(text="⪻ ʙᴀᴄᴋ ᴛᴏ ᴍᴀɪɴ ᴘᴀɢᴇ", callback_data=f"next_{req}_{key}_{offset}")])
await query.message.edit_text("<b>ɪɴ ᴡʜɪᴄʜ sᴇᴀsᴏɴ ᴅᴏ ʏᴏᴜ ᴡᴀɴᴛ, ᴄʜᴏᴏsᴇ ғʀᴏᴍ ʜᴇʀᴇ ↓↓</b>", reply_markup=InlineKeyboardMarkup(btn))
return
@Client.on_callback_query(filters.regex(r"^season_search#"))
async def season_search(client: Client, query: CallbackQuery):
_, season, key, offset, orginal_offset, req = query.data.split("#")
seas = int(season.split(' ' , 1)[1])
if seas < 10:
seas = f'S0{seas}'
else:
seas = f'S{seas}'
if int(req) != query.from_user.id:
return await query.answer(script.ALRT_TXT, show_alert=True)
offset = int(offset)
search = BUTTONS.get(key)
cap = CAP.get(key)
if not search:
await query.answer(script.OLD_ALRT_TXT.format(query.from_user.first_name),show_alert=True)
return
search = search.replace("_", " ")
files, n_offset, total = await get_search_results(f"{search} {seas}", max_results=int(MAX_BTN), offset=offset)
files2, n_offset2, total2 = await get_search_results(f"{search} {season}", max_results=int(MAX_BTN), offset=offset)
total += total2
try:
n_offset = int(n_offset)
except:
try:
n_offset = int(n_offset2)
except :
n_offset = 0
files = [file for file in files if re.search(seas, file.file_name, re.IGNORECASE)]
if not files:
files = [file for file in files2 if re.search(season, file.file_name, re.IGNORECASE)]
if not files:
await query.answer(f"sᴏʀʀʏ {season.title()} ɴᴏᴛ ғᴏᴜɴᴅ ғᴏʀ {search}", show_alert=1)
return
batch_ids = files
temp.FILES_ID[f"{query.message.chat.id}-{query.id}"] = batch_ids
batch_link = f"batchfiles#{query.message.chat.id}#{query.id}#{query.from_user.id}"
reqnxt = query.from_user.id if query.from_user else 0
settings = await get_settings(query.message.chat.id)
temp.CHAT[query.from_user.id] = query.message.chat.id
ads, ads_name, _ = await mdb.get_advirtisment()
ads_text = ""
if ads is not None and ads_name is not None:
ads_url = f"https://t.me/{temp.U_NAME}?start=ads"
ads_text = f"<a href={ads_url}>{ads_name}</a>"
js_ads = f"\n━━━━━━━━━━━━━━━━━━\n <b>{ads_text}</b> \n━━━━━━━━━━━━━━━━━━" if ads_text else ""
# del_msg = f"\n\n<b>⚠️ ᴛʜɪs ᴍᴇssᴀɢᴇ ᴡɪʟʟ ʙᴇ ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀꜰᴛᴇʀ <code>{get_readable_time(DELETE_TIME)}</code> ᴛᴏ ᴀᴠᴏɪᴅ ᴄᴏᴘʏʀɪɢʜᴛ ɪssᴜᴇs</b>" if settings["auto_delete"] else ''
links = ""
if settings["link"]:
btn = []
for file_num, file in enumerate(files, start=offset+1):
links += f"""<b>\n\n{file_num}. <a href=https://t.me/{temp.U_NAME}?start=file_{query.message.chat.id}_{file.file_id}>[{get_size(file.file_size)}] {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}</a></b>"""
else:
btn = [[
InlineKeyboardButton(text=f"🔗 {get_size(file.file_size)}≽ {formate_file_name(file.file_name)}", callback_data=f'files#{reqnxt}#{file.file_id}'),]
for file in files
]
btn.insert(0,[
InlineKeyboardButton("📥 𝗦𝗲𝗻𝗱 𝗔𝗹𝗹 𝗙𝗶𝗹𝗲𝘀 📥", callback_data=batch_link),
])
btn.insert(1, [
InlineKeyboardButton("ǫᴜᴀʟɪᴛʏ ", callback_data=f"qualities#{key}#{offset}#{req}"),
InlineKeyboardButton("ꜱᴇᴀꜱᴏɴ", callback_data=f"seasons#{key}#{offset}#{req}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ ", callback_data=f"languages#{key}#{offset}#{req}")
])
if n_offset== '':
btn.append(
[InlineKeyboardButton(text="🚸 ɴᴏ ᴍᴏʀᴇ ᴘᴀɢᴇs 🚸", callback_data="buttons")]
)
elif n_offset == 0:
btn.append(
[InlineKeyboardButton("⪻ ʙᴀᴄᴋ", callback_data=f"season_search#{season}#{key}#{offset- int(MAX_BTN)}#{orginal_offset}#{req}"),
InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}", callback_data="pages",),
])
elif offset==0:
btn.append(
[InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}",callback_data="pages",),
InlineKeyboardButton("ɴᴇxᴛ ⪼", callback_data=f"season_search#{season}#{key}#{n_offset}#{orginal_offset}#{req}"),])
else:
btn.append(
[InlineKeyboardButton("⪻ ʙᴀᴄᴋ", callback_data=f"season_search#{season}#{key}#{offset- int(MAX_BTN)}#{orginal_offset}#{req}"),
InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}", callback_data="pages",),
InlineKeyboardButton("ɴᴇxᴛ ⪼", callback_data=f"season_search#{season}#{key}#{n_offset}#{orginal_offset}#{req}"),])
btn.append([
InlineKeyboardButton(text="⪻ ʙᴀᴄᴋ ᴛᴏ ᴍᴀɪɴ ᴘᴀɢᴇ", callback_data=f"next_{req}_{key}_{orginal_offset}"),])
await query.message.edit_text(cap + links + js_ads, disable_web_page_preview=True, parse_mode=enums.ParseMode.HTML, reply_markup=InlineKeyboardMarkup(btn))
return
@Client.on_callback_query(filters.regex(r"^years#"))
async def years_cb_handler(client: Client, query: CallbackQuery):
_, key, offset, req = query.data.split("#")
if int(req) != query.from_user.id:
return await query.answer(script.ALRT_TXT, show_alert=True)
btn = []
for i in range(0, len(YEARS)-1, 3):
btn.append([
InlineKeyboardButton(
text=YEARS[i].title(),
callback_data=f"years_search#{YEARS[i].lower()}#{key}#0#{offset}#{req}"
),
InlineKeyboardButton(
text=YEARS[i+1].title(),
callback_data=f"years_search#{YEARS[i+1].lower()}#{key}#0#{offset}#{req}"
),
InlineKeyboardButton(
text=YEARS[i+2].title(),
callback_data=f"years_search#{YEARS[i+2].lower()}#{key}#0#{offset}#{req}"
),
])
btn.append([InlineKeyboardButton(text="⪻ ʙᴀᴄᴋ ᴛᴏ ᴍᴀɪɴ ᴘᴀɢᴇ", callback_data=f"next_{req}_{key}_{offset}")])
await query.message.edit_text("<b>ɪɴ ᴡʜɪᴄʜ ʏᴇᴀʀ ᴅᴏ ʏᴏᴜ ᴡᴀɴᴛ, ᴄʜᴏᴏsᴇ ғʀᴏᴍ ʜᴇʀᴇ ↓↓</b>", reply_markup=InlineKeyboardMarkup(btn))
return
@Client.on_callback_query(filters.regex(r"^years_search#"))
async def year_search(client: Client, query: CallbackQuery):
_, year, key, offset, orginal_offset, req = query.data.split("#")
if int(req) != query.from_user.id:
return await query.answer(script.ALRT_TXT, show_alert=True)
offset = int(offset)
search = BUTTONS.get(key)
cap = CAP.get(key)
if not search:
await query.answer(script.OLD_ALRT_TXT.format(query.from_user.first_name),show_alert=True)
return
search = search.replace("_", " ")
files, n_offset, total = await get_search_results(f"{search} {year}", max_results=int(MAX_BTN), offset=offset)
try:
n_offset = int(n_offset)
except:
n_offset = 0
files = [file for file in files if re.search(year, file.file_name, re.IGNORECASE)]
if not files:
await query.answer(f"sᴏʀʀʏ ʏᴇᴀʀ {year.title()} ɴᴏᴛ ғᴏᴜɴᴅ ғᴏʀ {search}", show_alert=1)
return
batch_ids = files
temp.FILES_ID[f"{query.message.chat.id}-{query.id}"] = batch_ids
batch_link = f"batchfiles#{query.message.chat.id}#{query.id}#{query.from_user.id}"
reqnxt = query.from_user.id if query.from_user else 0
settings = await get_settings(query.message.chat.id)
temp.CHAT[query.from_user.id] = query.message.chat.id
ads, ads_name, _ = await mdb.get_advirtisment()
ads_text = ""
if ads is not None and ads_name is not None:
ads_url = f"https://t.me/{temp.U_NAME}?start=ads"
ads_text = f"<a href={ads_url}>{ads_name}</a>"
js_ads = f"\n━━━━━━━━━━━━━━━━━━\n <b>{ads_text}</b> \n━━━━━━━━━━━━━━━━━━" if ads_text else ""
#del_msg = f"\n\n<b>⚠️ ᴛʜɪs ᴍᴇssᴀɢᴇ ᴡɪʟʟ ʙᴇ ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀꜰᴛᴇʀ <code>{get_readable_time(DELETE_TIME)}</code> ᴛᴏ ᴀᴠᴏɪᴅ ᴄᴏᴘʏʀɪɢʜᴛ ɪssᴜᴇs</b>" if settings["auto_delete"] else ''
links = ""
if settings["link"]:
btn = []
for file_num, file in enumerate(files, start=offset+1):
links += f"""<b>\n\n{file_num}. <a href=https://t.me/{temp.U_NAME}?start=file_{query.message.chat.id}_{file.file_id}>[{get_size(file.file_size)}] {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}</a></b>"""
else:
btn = [[
InlineKeyboardButton(text=f"🔗 {get_size(file.file_size)}≽ {formate_file_name(file.file_name)}", callback_data=f'files#{reqnxt}#{file.file_id}'),]
for file in files
]
btn.insert(0,[
InlineKeyboardButton("📥 𝗦𝗲𝗻𝗱 𝗔𝗹𝗹 𝗙𝗶𝗹𝗲𝘀 📥", callback_data=batch_link),
])
btn.insert(1, [
InlineKeyboardButton("ǫᴜᴀʟɪᴛʏ ", callback_data=f"qualities#{key}#{offset}#{req}"),
InlineKeyboardButton("ꜱᴇᴀꜱᴏɴ", callback_data=f"seasons#{key}#{offset}#{req}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ ", callback_data=f"languages#{key}#{offset}#{req}")
])
if n_offset== '':
btn.append(
[InlineKeyboardButton(text="🚸 ɴᴏ ᴍᴏʀᴇ ᴘᴀɢᴇs 🚸", callback_data="buttons")]
)
elif n_offset == 0:
btn.append(
[InlineKeyboardButton("⪻ ʙᴀᴄᴋ", callback_data=f"years_search#{year}#{key}#{offset- int(MAX_BTN)}#{orginal_offset}#{req}"),
InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}", callback_data="pages",),
])
elif offset==0:
btn.append(
[InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}",callback_data="pages",),
InlineKeyboardButton("ɴᴇxᴛ ⪼", callback_data=f"years_search#{year}#{key}#{n_offset}#{orginal_offset}#{req}"),])
else:
btn.append(
[InlineKeyboardButton("⪻ ʙᴀᴄᴋ", callback_data=f"years_search#{year}#{key}#{offset- int(MAX_BTN)}#{orginal_offset}#{req}"),
InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}", callback_data="pages",),
InlineKeyboardButton("ɴᴇxᴛ ⪼", callback_data=f"years_search#{year}#{key}#{n_offset}#{orginal_offset}#{req}"),])
btn.append([
InlineKeyboardButton(text="⪻ ʙᴀᴄᴋ ᴛᴏ ᴍᴀɪɴ ᴘᴀɢᴇ", callback_data=f"next_{req}_{key}_{orginal_offset}"),])
await query.message.edit_text(cap + links + js_ads, disable_web_page_preview=True, parse_mode=enums.ParseMode.HTML, reply_markup=InlineKeyboardMarkup(btn))
return
@Client.on_callback_query(filters.regex(r"^qualities#"))
async def quality_cb_handler(client: Client, query: CallbackQuery):
_, key, offset, req = query.data.split("#")
if int(req) != query.from_user.id:
return await query.answer(script.ALRT_TXT, show_alert=True)
btn= []
for i in range(0, len(QUALITIES)-1, 3):
btn.append([
InlineKeyboardButton(
text=QUALITIES[i].title(),
callback_data=f"quality_search#{QUALITIES[i].lower()}#{key}#0#{offset}#{req}"
),
InlineKeyboardButton(
text=QUALITIES[i+1].title(),
callback_data=f"quality_search#{QUALITIES[i+1].lower()}#{key}#0#{offset}#{req}"
),
InlineKeyboardButton(
text=QUALITIES[i+2].title(),
callback_data=f"quality_search#{QUALITIES[i+2].lower()}#{key}#0#{offset}#{req}"
),
])
btn.append([InlineKeyboardButton(text="⪻ ʙᴀᴄᴋ ᴛᴏ ᴍᴀɪɴ ᴘᴀɢᴇ", callback_data=f"next_{req}_{key}_{offset}")])
await query.message.edit_text("<b>ɪɴ ᴡʜɪᴄʜ ǫᴜᴀʟɪᴛʏ ᴅᴏ ʏᴏᴜ ᴡᴀɴᴛ, ᴄʜᴏᴏsᴇ ғʀᴏᴍ ʜᴇʀᴇ ↓↓</b>", reply_markup=InlineKeyboardMarkup(btn))
return
@Client.on_callback_query(filters.regex(r"^quality_search#"))
async def quality_search(client: Client, query: CallbackQuery):
_, qul, key, offset, orginal_offset, req = query.data.split("#")
if int(req) != query.from_user.id:
return await query.answer(script.ALRT_TXT, show_alert=True)
offset = int(offset)
search = BUTTONS.get(key)
cap = CAP.get(key)
if not search:
await query.answer(script.OLD_ALRT_TXT.format(query.from_user.first_name),show_alert=True)
return
search = search.replace("_", " ")
files, n_offset, total = await get_search_results(f"{search} {qul}", max_results=int(MAX_BTN), offset=offset)
try:
n_offset = int(n_offset)
except:
n_offset = 0
files = [file for file in files if re.search(qul, file.file_name, re.IGNORECASE)]
if not files:
await query.answer(f"sᴏʀʀʏ ǫᴜᴀʟɪᴛʏ {qul.title()} ɴᴏᴛ ғᴏᴜɴᴅ ғᴏʀ {search}", show_alert=1)
return
batch_ids = files
temp.FILES_ID[f"{query.message.chat.id}-{query.id}"] = batch_ids
batch_link = f"batchfiles#{query.message.chat.id}#{query.id}#{query.from_user.id}"
reqnxt = query.from_user.id if query.from_user else 0
settings = await get_settings(query.message.chat.id)
temp.CHAT[query.from_user.id] = query.message.chat.id
ads, ads_name, _ = await mdb.get_advirtisment()
ads_text = ""
if ads is not None and ads_name is not None:
ads_url = f"https://t.me/{temp.U_NAME}?start=ads"
ads_text = f"<a href={ads_url}>{ads_name}</a>"
js_ads = f"\n━━━━━━━━━━━━━━━━━━\n <b>{ads_text}</b> \n━━━━━━━━━━━━━━━━━━" if ads_text else ""
# del_msg = f"\n\n<b>⚠️ ᴛʜɪs ᴍᴇssᴀɢᴇ ᴡɪʟʟ ʙᴇ ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀꜰᴛᴇʀ <code>{get_readable_time(DELETE_TIME)}</code> ᴛᴏ ᴀᴠᴏɪᴅ ᴄᴏᴘʏʀɪɢʜᴛ ɪssᴜᴇs</b>" if settings["auto_delete"] else ''
links = ""
if settings["link"]:
btn = []
for file_num, file in enumerate(files, start=offset+1):
links += f"""<b>\n\n{file_num}. <a href=https://t.me/{temp.U_NAME}?start=file_{query.message.chat.id}_{file.file_id}>[{get_size(file.file_size)}] {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}</a></b>"""
else:
btn = [[
InlineKeyboardButton(text=f"🔗 {get_size(file.file_size)}≽ {formate_file_name(file.file_name)}", callback_data=f'files#{reqnxt}#{file.file_id}'),]
for file in files
]
btn.insert(0,[
InlineKeyboardButton("📥 𝗦𝗲𝗻𝗱 𝗔𝗹𝗹 𝗙𝗶𝗹𝗲𝘀 📥", callback_data=batch_link),
])
btn.insert(1, [
InlineKeyboardButton("ǫᴜᴀʟɪᴛʏ", callback_data=f"qualities#{key}#{offset}#{req}"),
InlineKeyboardButton("ꜱᴇᴀꜱᴏɴ", callback_data=f"seasons#{key}#{offset}#{req}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ", callback_data=f"languages#{key}#{offset}#{req}"),
])
if n_offset== '':
btn.append(
[InlineKeyboardButton(text="🚸 ɴᴏ ᴍᴏʀᴇ ᴘᴀɢᴇs 🚸", callback_data="buttons")]
)
elif n_offset == 0:
btn.append(
[InlineKeyboardButton("⪻ ʙᴀᴄᴋ", callback_data=f"quality_search#{qul}#{key}#{offset- int(MAX_BTN)}#{orginal_offset}#{req}"),
InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}", callback_data="pages",),
])
elif offset==0:
btn.append(
[InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}",callback_data="pages",),
InlineKeyboardButton("ɴᴇxᴛ ⪼", callback_data=f"quality_search#{qul}#{key}#{n_offset}#{orginal_offset}#{req}"),])
else:
btn.append(
[InlineKeyboardButton("⪻ ʙᴀᴄᴋ", callback_data=f"quality_search#{qul}#{key}#{offset- int(MAX_BTN)}#{orginal_offset}#{req}"),
InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}", callback_data="pages",),
InlineKeyboardButton("ɴᴇxᴛ ⪼", callback_data=f"quality_search#{qul}#{key}#{n_offset}#{orginal_offset}#{req}"),])
btn.append([
InlineKeyboardButton(text="⪻ ʙᴀᴄᴋ ᴛᴏ ᴍᴀɪɴ ᴘᴀɢᴇ", callback_data=f"next_{req}_{key}_{orginal_offset}"),])
await query.message.edit_text(cap + links + js_ads, disable_web_page_preview=True, parse_mode=enums.ParseMode.HTML, reply_markup=InlineKeyboardMarkup(btn))
return
await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(btn))
@Client.on_callback_query(filters.regex(r"^languages#"))
async def languages_cb_handler(client: Client, query: CallbackQuery):
_, key, offset, req = query.data.split("#")
if int(req) != query.from_user.id:
return await query.answer(script.ALRT_TXT, show_alert=True)
btn = []
for i in range(0, len(LANGUAGES)-1, 2):
btn.append([
InlineKeyboardButton(
text=LANGUAGES[i].title(),
callback_data=f"lang_search#{LANGUAGES[i].lower()}#{key}#0#{offset}#{req}"
),
InlineKeyboardButton(
text=LANGUAGES[i+1].title(),
callback_data=f"lang_search#{LANGUAGES[i+1].lower()}#{key}#0#{offset}#{req}"
),
])
btn.append([InlineKeyboardButton(text="⪻ ʙᴀᴄᴋ ᴛᴏ ᴍᴀɪɴ ᴘᴀɢᴇ", callback_data=f"next_{req}_{key}_{offset}")])
await query.message.edit_text("<b>ɪɴ ᴡʜɪᴄʜ ʟᴀɴɢᴜᴀɢᴇ ᴅᴏ ʏᴏᴜ ᴡᴀɴᴛ, ᴄʜᴏᴏsᴇ ғʀᴏᴍ ʜᴇʀᴇ ↓↓</b>", reply_markup=InlineKeyboardMarkup(btn))
return
@Client.on_callback_query(filters.regex(r"^lang_search#"))
async def lang_search(client: Client, query: CallbackQuery):
_, lang, key, offset, orginal_offset, req = query.data.split("#")
lang2 = lang[:3]
if int(req) != query.from_user.id:
return await query.answer(script.ALRT_TXT, show_alert=True)
offset = int(offset)
search = BUTTONS.get(key)
cap = CAP.get(key)
if not search:
await query.answer(script.OLD_ALRT_TXT.format(query.from_user.first_name),show_alert=True)
return
search = search.replace("_", " ")
files, n_offset, total = await get_search_results(f"{search} {lang}", max_results=int(MAX_BTN), offset=offset)
files2, n_offset2, total2 = await get_search_results(f"{search} {lang2}", max_results=int(MAX_BTN), offset=offset)
total += total2
try:
n_offset = int(n_offset)
except:
try:
n_offset = int(n_offset2)
except :
n_offset = 0
files = [file for file in files if re.search(lang, file.file_name, re.IGNORECASE)]
if not files:
files = [file for file in files2 if re.search(lang2, file.file_name, re.IGNORECASE)]
if not files:
return await query.answer(f"sᴏʀʀʏ ʟᴀɴɢᴜᴀɢᴇ {lang.title()} ɴᴏᴛ ғᴏᴜɴᴅ ғᴏʀ {search}", show_alert=1)
batch_ids = files
temp.FILES_ID[f"{query.message.chat.id}-{query.id}"] = batch_ids
batch_link = f"batchfiles#{query.message.chat.id}#{query.id}#{query.from_user.id}"
reqnxt = query.from_user.id if query.from_user else 0
settings = await get_settings(query.message.chat.id)
group_id = query.message.chat.id
temp.CHAT[query.from_user.id] = query.message.chat.id
ads, ads_name, _ = await mdb.get_advirtisment()
ads_text = ""
if ads is not None and ads_name is not None:
ads_url = f"https://t.me/{temp.U_NAME}?start=ads"
ads_text = f"<a href={ads_url}>{ads_name}</a>"
js_ads = f"\n━━━━━━━━━━━━━━━━━━\n <b>{ads_text}</b> \n━━━━━━━━━━━━━━━━━━" if ads_text else ""
#del_msg = f"\n\n<b>⚠️ ᴛʜɪs ᴍᴇssᴀɢᴇ ᴡɪʟʟ ʙᴇ ᴀᴜᴛᴏ ᴅᴇʟᴇᴛᴇ ᴀꜰᴛᴇʀ <code>{get_readable_time(DELETE_TIME)}</code> ᴛᴏ ᴀᴠᴏɪᴅ ᴄᴏᴘʏʀɪɢʜᴛ ɪssᴜᴇs</b>" if settings["auto_delete"] else ''
links = ""
if settings["link"]:
btn = []
for file_num, file in enumerate(files, start=offset+1):
links += f"""<b>\n\n{file_num}. <a href=https://t.me/{temp.U_NAME}?start=file_{query.message.chat.id}_{file.file_id}>[{get_size(file.file_size)}] {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file.file_name.split()))}</a></b>"""
else:
btn = [[
InlineKeyboardButton(text=f"🔗 {get_size(file.file_size)}≽ {formate_file_name(file.file_name)}", callback_data=f'files#{reqnxt}#{file.file_id}'),]
for file in files
]
btn.insert(0,[
InlineKeyboardButton("📥 𝗦𝗲𝗻𝗱 𝗔𝗹𝗹 𝗙𝗶𝗹𝗲𝘀 📥", callback_data=batch_link),
])
btn.insert(1, [
InlineKeyboardButton("ǫᴜᴀʟɪᴛʏ", callback_data=f"qualities#{key}#{offset}#{req}"),
InlineKeyboardButton("ꜱᴇᴀꜱᴏɴ", callback_data=f"seasons#{key}#{offset}#{req}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇ", callback_data=f"languages#{key}#{offset}#{req}")
])
if n_offset== '':
btn.append(
[InlineKeyboardButton(text="🚸 ɴᴏ ᴍᴏʀᴇ ᴘᴀɢᴇs 🚸", callback_data="buttons")]
)
elif n_offset == 0:
btn.append(
[InlineKeyboardButton("⪻ ʙᴀᴄᴋ", callback_data=f"lang_search#{lang}#{key}#{offset- int(MAX_BTN)}#{orginal_offset}#{req}"),
InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}", callback_data="pages",),
])
elif offset==0:
btn.append(
[InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}",callback_data="pages",),
InlineKeyboardButton("ɴᴇxᴛ ⪼", callback_data=f"lang_search#{lang}#{key}#{n_offset}#{orginal_offset}#{req}"),])
else:
btn.append(
[InlineKeyboardButton("⪻ ʙᴀᴄᴋ", callback_data=f"lang_search#{lang}#{key}#{offset- int(MAX_BTN)}#{orginal_offset}#{req}"),
InlineKeyboardButton(f"{math.ceil(offset / int(MAX_BTN)) + 1}/{math.ceil(total / int(MAX_BTN))}", callback_data="pages",),
InlineKeyboardButton("ɴᴇxᴛ ⪼", callback_data=f"lang_search#{lang}#{key}#{n_offset}#{orginal_offset}#{req}"),])
btn.append([
InlineKeyboardButton(text="⪻ ʙᴀᴄᴋ ᴛᴏ ᴍᴀɪɴ ᴘᴀɢᴇ", callback_data=f"next_{req}_{key}_{orginal_offset}"),])
await query.message.edit_text(cap + links + js_ads, disable_web_page_preview=True, parse_mode=enums.ParseMode.HTML, reply_markup=InlineKeyboardMarkup(btn))
return
await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(btn))
@Client.on_callback_query(filters.regex(r"^spol"))
async def advantage_spoll_choker(bot, query):
_, id, user = query.data.split('#')
if int(user) != 0 and query.from_user.id != int(user):
return await query.answer(script.ALRT_TXT, show_alert=True)
movie = await get_poster(id, id=True)
search = movie.get('title')
await query.answer('bhai sahab hamare pass nahin Hai')
files, offset, total_results = await get_search_results(search)
if files:
k = (search, files, offset, total_results)
await auto_filter(bot, query, k)
else:
k = await query.message.edit(script.NO_RESULT_TXT)
await asyncio.sleep(60)
await k.delete()
try:
await query.message.reply_to_message.delete()
except:
pass
@Client.on_callback_query()
async def cb_handler(client: Client, query: CallbackQuery):
if query.data == "close_data":
try:
user = query.message.reply_to_message.from_user.id
except:
user = query.from_user.id
if int(user) != 0 and query.from_user.id != int(user):
return await query.answer(script.ALRT_TXT, show_alert=True)
await query.answer("ᴛʜᴀɴᴋs ꜰᴏʀ ᴄʟᴏsᴇ ")
await query.message.delete()
try:
await query.message.reply_to_message.delete()
except:
pass
elif query.data == "delallcancel":
userid = query.from_user.id
chat_type = query.message.chat.type
if chat_type == enums.ChatType.PRIVATE:
await query.message.reply_to_message.delete()
await query.message.delete()
elif chat_type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]:
grp_id = query.message.chat.id
st = await client.get_chat_member(grp_id, userid)
if (st.status == enums.ChatMemberStatus.OWNER) or (str(userid) in ADMINS):
await query.message.delete()
try:
await query.message.reply_to_message.delete()
except:
pass
else:
await query.answer(script.ALRT_TXT.format(query.from_user.first_name), show_alert=True)
elif query.data.startswith("checksub"):
ident, file_id , grp_id = query.data.split("#")
if grp_id != 'None' or grp_id != '':
chat_id = grp_id
else:
chat_id = query.message.chat.id
if AUTH_CHANNEL and not await is_req_subscribed(client, query):
await query.answer("ɪ ʟɪᴋᴇ ʏᴏᴜʀ sᴍᴀʀᴛɴᴇss ʙᴜᴛ ᴅᴏɴ'ᴛ ʙᴇ ᴏᴠᴇʀsᴍᴀʀᴛ 😒\nꜰɪʀsᴛ ᴊᴏɪɴ ᴏᴜʀ ᴜᴘᴅᴀᴛᴇs ᴄʜᴀɴɴᴇʟ 😒", show_alert=True)
return
files_ = await get_file_details(file_id)
if not files_:
return await query.answer('ɴᴏ sᴜᴄʜ ꜰɪʟᴇ ᴇxɪsᴛs 🚫')
files = files_[0]
btn = [[
InlineKeyboardButton('🎗️ ɢᴇᴛ ʏᴏᴜʀ ғɪʟᴇ 🎗️', url=f'https://t.me/{temp.U_NAME}?start=file_{chat_id}_{file_id}')
]]
reply_markup = InlineKeyboardMarkup(btn)
return await query.message.edit(text=f'<b>ᴛʜᴀɴᴋs ғᴏʀ ᴊᴏɪɴɪɴɢ ᴏᴜʀ ᴄʜᴀɴɴᴇʟ 🔥😗\nɢᴇᴛ ʏᴏᴜʀ ғɪʟᴇ : {files.file_name[:20]}.. ʙʏ ᴄʟɪᴄᴋɪɴɢ ᴛʜᴇ ʙᴜᴛᴛᴏɴ ʙᴇʟᴏᴡ ⚡\n\nᴍᴀɪɴᴛᴀɪɴᴇᴅ ʙʏ : @JISSHU_BOTS</b>',reply_markup=reply_markup)
elif query.data == "give_trial":
user_id = query.from_user.id
has_free_trial = await db.check_trial_status(user_id)
if has_free_trial:
await query.answer(" ʏᴏᴜ'ᴠᴇ ᴀʟʀᴇᴀᴅʏ ᴄʟᴀɪᴍᴇᴅ ʏᴏᴜʀ ꜰʀᴇᴇ ᴛʀɪᴀʟ ᴏɴᴄᴇ !\n\n📌 ᴄʜᴇᴄᴋᴏᴜᴛ ᴏᴜʀ ᴘʟᴀɴꜱ ʙʏ : /plan", show_alert=True)
return
else:
await db.give_free_trial(user_id)
await query.message.edit_text(
text="ᴄᴏɴɢʀᴀᴛᴜʟᴀᴛɪᴏɴꜱ🎉 ʏᴏᴜ ᴄᴀɴ ᴜsᴇ ꜰʀᴇᴇ ᴛʀᴀɪʟ ꜰᴏʀ <u>5 ᴍɪɴᴜᴛᴇs</u> ꜰʀᴏᴍ ɴᴏᴡ !\n\nɴᴏᴡ ᴇxᴘᴇʀɪᴇɴᴄᴇ ᴏᴜʀ ᴘʀᴇᴍɪᴜᴍ ꜱᴇʀᴠɪᴄᴇ ꜰᴏʀ 5 ᴍɪɴᴜᴛᴇꜱ. ᴛᴏ ʙᴜʏ ᴏᴜʀ ᴘʀᴇᴍɪᴜᴍ ꜱᴇʀᴠɪᴄᴇ ᴄʟɪᴄᴋ ᴏɴ ʙᴇʟᴏᴡ ʙᴜᴛᴛᴏɴ.",
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("💸 ᴄʜᴇᴄᴋᴏᴜᴛ ᴘʀᴇᴍɪᴜᴍ ᴘʟᴀɴꜱ 💸", callback_data='seeplans')]]))
await client.send_message(LOG_CHANNEL, text=f"#FREE_TRAIL_CLAIMED\n\n👤 ᴜꜱᴇʀ ɴᴀᴍᴇ - {query.from_user.mention}\n⚡ ᴜꜱᴇʀ ɪᴅ - {user_id}", disable_web_page_preview=True)
return
elif query.data.startswith("stream"):
user_id = query.from_user.id
file_id = query.data.split('#', 1)[1]
log_msg = await client.send_cached_media(
chat_id=LOG_CHANNEL,
file_id=file_id
)
fileName = quote_plus(get_name(log_msg))
online = f"{URL}watch/{log_msg.id}/{fileName}?hash={get_hash(log_msg)}"
download = f"{URL}{log_msg.id}/{fileName}?hash={get_hash(log_msg)}"
btn = [[
InlineKeyboardButton("ᴡᴀᴛᴄʜ ᴏɴʟɪɴᴇ", url=online),
InlineKeyboardButton("ꜰᴀsᴛ ᴅᴏᴡɴʟᴏᴀᴅ", url=download)
],[
InlineKeyboardButton('❌ ᴄʟᴏsᴇ ❌', callback_data='close_data')
]]
await query.edit_message_reply_markup(
reply_markup=InlineKeyboardMarkup(btn)
)
username = query.from_user.username
await log_msg.reply_text(
text=f"#LinkGenrated\n\nIᴅ : <code>{user_id}</code>\nUꜱᴇʀɴᴀᴍᴇ : {username}\n\nNᴀᴍᴇ : {fileName}",
quote=True,
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup([
[
InlineKeyboardButton("🚀 ꜰᴀꜱᴛ ᴅᴏᴡɴʟᴏᴀᴅ", url=download),
InlineKeyboardButton('ᴡᴀᴛᴄʜ ᴏɴʟɪɴᴇ 🧿', url=online)
]
])
)
elif query.data == "buttons":
await query.answer("ɴᴏ ᴍᴏʀᴇ ᴘᴀɢᴇs 😊", show_alert=True)
elif query.data == "pages":
await query.answer("ᴛʜɪs ɪs ᴘᴀɢᴇs ʙᴜᴛᴛᴏɴ 😅")
elif query.data.startswith("lang_art"):
_, lang = query.data.split("#")
await query.answer(f"ʏᴏᴜ sᴇʟᴇᴄᴛᴇᴅ {lang.title()} ʟᴀɴɢᴜᴀɢᴇ ⚡️", show_alert=True)
elif query.data == "start":
buttons = [[
InlineKeyboardButton('☆ Aᴅᴅ Mᴇ Tᴏ Yᴏᴜʀ Gʀᴏᴜᴘ ☆', url=f'http://t.me/{temp.U_NAME}?startgroup=start')
],[
InlineKeyboardButton("Hᴇʟᴘ ⚙️", callback_data='features'),
InlineKeyboardButton('Aʙᴏᴜᴛ 💌', callback_data=f'about')
],[
InlineKeyboardButton('Pʀᴇᴍɪᴜᴍ 🎫', callback_data='seeplans'),
InlineKeyboardButton('Rᴇғᴇʀ ⚜️', callback_data="reffff")
],[
InlineKeyboardButton('Mᴏsᴛ Sᴇᴀʀᴄʜ 🔍', callback_data="mostsearch"),
InlineKeyboardButton('Tᴏᴘ Tʀᴇɴᴅɪɴɢ ⚡', callback_data="trending")
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.START_TXT.format(query.from_user.mention, get_status(), query.from_user.id),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "seeplans":
btn = [[
InlineKeyboardButton('🍁 𝗖𝗹𝗶𝗰𝗸 𝗔𝗹𝗹 𝗣𝗹𝗮𝗻𝘀 & 𝗣𝗿𝗶𝗰𝗲𝘀 🍁', callback_data='free')
],[
InlineKeyboardButton('• 𝗖𝗹𝗼𝘀𝗲 •', callback_data='close_data')
]]
reply_markup = InlineKeyboardMarkup(btn)
m=await query.message.reply_sticker("CAACAgQAAxkBAAEiLZ9l7VMuTY7QHn4edR6ouHUosQQ9gwACFxIAArzT-FOmYU0gLeJu7x4E")
await m.delete()
await query.message.reply_photo(
photo=(SUBSCRIPTION),
caption=script.PREPLANS_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "free":
buttons = [[
InlineKeyboardButton('☆📸 𝙎𝙚𝙣𝙙 𝙨𝙘𝙧𝙚𝙚𝙣𝙨𝙝𝙤𝙩 📸☆', url=f'https://t.me/innocent_babe_dead')
],[
InlineKeyboardButton('💎 𝗖𝘂𝘀𝘁𝗼𝗺 𝗣𝗹𝗮𝗻 💎', callback_data='other')
],[
InlineKeyboardButton('• 𝗕𝗮𝗰𝗸 •', callback_data='broze'),
InlineKeyboardButton('• 𝗖𝗹𝗼𝘀𝗲 •', callback_data='close_data')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await client.edit_message_media(
query.message.chat.id,
query.message.id,
InputMediaPhoto(random.choice(PAYPICS))
)
await query.message.edit_text(
text=script.FREE_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
#jisshu
elif query.data == "broze":
buttons = [[
InlineKeyboardButton('🍁 𝗖𝗹𝗶𝗰𝗸 𝗔𝗹𝗹 𝗣𝗹𝗮𝗻𝘀 & 𝗣𝗿𝗶𝗰𝗲𝘀 🍁', callback_data='free')
], [
InlineKeyboardButton('• 𝗖𝗹𝗼𝘀𝗲 •', callback_data='close_data')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_media(
media=InputMediaPhoto(
media=SUBSCRIPTION,
caption=script.PREPLANSS_TXT.format(query.from_user.mention()),
parse_mode=enums.ParseMode.HTML
),
reply_markup=reply_markup
)
elif query.data == "other":
buttons = [[
InlineKeyboardButton('☎️ 𝗖𝗼𝗻𝘁𝗮𝗰𝘁 𝗢𝘄𝗻𝗲𝗿 𝗧𝗼 𝗞𝗻𝗼𝘄 𝗠𝗼𝗿𝗲', user_id = ADMINS[0])
],[
InlineKeyboardButton('• 𝗕𝗮𝗰𝗸 •', callback_data='free')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await client.edit_message_media(
query.message.chat.id,
query.message.id,
InputMediaPhoto(random.choice(PAYPICS))
)
await query.message.edit_text(
text=script.OTHER_TXT.format(query.from_user.mention),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "ref_point":
await query.answer(f'You Have: {referdb.get_refer_points(query.from_user.id)} Refferal points.', show_alert=True)
elif query.data == "verifyon":
await query.answer(f'Only the bot admin can ᴏɴ ✓ or ᴏғғ ✗ this feature.', show_alert=True)
elif query.data == "features":
buttons = [[
InlineKeyboardButton('Aᴅᴍɪɴ Cᴏᴍᴍᴀɴᴅs', callback_data='admincmd'),
InlineKeyboardButton('Iᴍᴀɢᴇ Tᴏ Lɪɴᴋ', callback_data='telegraph'),
], [
InlineKeyboardButton('F-Sᴜʙ', callback_data='fsub'),
InlineKeyboardButton('Gʀᴏᴜᴘ Sᴇᴛᴜᴘ', callback_data='earn')
], [
InlineKeyboardButton('⋞ Back To Home', callback_data='start')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_media(
media=InputMediaPhoto(
media=START_IMG,
caption=script.HELP_TXT,
parse_mode=enums.ParseMode.HTML
),
reply_markup=reply_markup
)
# await query.message.edit_text(
# text=script.HELP_TXT,
# reply_markup=reply_markup,
# parse_mode=enums.ParseMode.HTML
# )
elif query.data == "admincmd":
# If the user isn't an admin, return
if query.from_user.id not in ADMINS:
return await query.answer('ᴛʜɪꜱ ɪꜱ ɴᴏᴛ ꜰᴏʀ ʏᴏᴜ ʙʀᴏ!', show_alert=True)
buttons = [[
InlineKeyboardButton('⋞ ʙᴀᴄᴋ', callback_data='features'),
InlineKeyboardButton('ɴᴇxᴛ ⪼', callback_data='admincmd2'),
]]
reply_markup = InlineKeyboardMarkup(buttons)
await client.edit_message_media(
chat_id=query.message.chat.id,
message_id=query.message.id,
media=InputMediaAnimation(
media="https://cdn.jsdelivr.net/gh/Jisshubot/JISSHU_BOTS/Video.mp4/Welcome_video_20240921_184741_0001.gif",
caption=script.ADMIN_CMD_TXT,
parse_mode=enums.ParseMode.HTML
),
reply_markup=reply_markup
)
elif query.data == "admincmd2":
buttons = [[
InlineKeyboardButton('⋞ ʙᴀᴄᴋ', callback_data='admincmd')]]
reply_markup = InlineKeyboardMarkup(buttons)
await client.edit_message_media(
chat_id=query.message.chat.id,
message_id=query.message.id,
media=InputMediaAnimation(
media="https://cdn.jsdelivr.net/gh/Jisshubot/JISSHU_BOTS/Video.mp4/Welcome_video_20240921_184741_0001.gif",
caption=script.ADMIN_CMD_TXT2,
parse_mode=enums.ParseMode.HTML
),
reply_markup=reply_markup
)
elif query.data == "fsub":
#add back button
buttons = [[
InlineKeyboardButton('⇆ ᴀᴅᴅ ᴍᴇ ᴛᴏ ʏᴏᴜʀ ɢʀᴏᴜᴘs ⇆', url=f'http://t.me/{temp.U_NAME}?startgroup=start')],
[InlineKeyboardButton('⋞ ʙᴀᴄᴋ', callback_data='features')]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.FSUB_TXT,
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == 'about':
await query.message.edit_text(
script.ABOUT_TEXT.format(query.from_user.mention(),temp.B_LINK),
reply_markup = InlineKeyboardMarkup(
[[
InlineKeyboardButton('‼️ ᴅɪꜱᴄʟᴀɪᴍᴇʀ ‼️', callback_data='disclaimer')
],[
InlineKeyboardButton('Sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ', callback_data='Source')
],[
InlineKeyboardButton('My Developers 😎',callback_data='mydevelopers')
],[
InlineKeyboardButton('⋞ ʜᴏᴍᴇ', callback_data='start')]]
),
disable_web_page_preview = True
)
elif query.data == "mydevelopers":