forked from HA-Bots/Auto-Filter-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpm_filter.py
1107 lines (1038 loc) · 54.1 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 random
import asyncio
import re
from time import time as time_now
import ast
import math
from pyrogram.errors.exceptions.bad_request_400 import MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty
from Script import script
from datetime import datetime, timedelta
import pyrogram
from info import ADMINS, URL, MAX_BTN, BIN_CHANNEL, IS_STREAM, DELETE_TIME, FILMS_LINK, AUTH_CHANNEL, IS_VERIFY, VERIFY_EXPIRE, LOG_CHANNEL, SUPPORT_GROUP, SUPPORT_LINK, UPDATES_LINK, PICS, PROTECT_CONTENT, IMDB, AUTO_FILTER, SPELL_CHECK, IMDB_TEMPLATE, AUTO_DELETE, LANGUAGES, IS_FSUB, PAYMENT_QR, PM_DELETE_TIME as pm_delete_time
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery, ChatPermissions
from pyrogram import Client, filters, enums
from pyrogram.errors import FloodWait, UserIsBlocked, MessageNotModified, PeerIdInvalid, ChatAdminRequired
from utils import get_size, is_subscribed, is_check_admin, get_wish, get_shortlink, get_verify_status, update_verify_status, get_readable_time, get_poster, temp, get_settings, save_group_settings
from database.users_chats_db import db
from database.ia_filterdb import Media, get_file_details, get_search_results,delete_files
import logging
BUTTONS = {}
CAP = {}
@Client.on_message(filters.private & filters.text & filters.incoming)
async def pm_search(client, message):
bot_id = client.me.id
files, n_offset, total = await get_search_results(message.text)
btn = [[
InlineKeyboardButton("🗂 ᴄʟɪᴄᴋ ʜᴇʀᴇ 🗂", url=FILMS_LINK)
]]
reply_markup=InlineKeyboardMarkup(btn)
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:
if int(total) != 0:
await message.reply_text(f'<b><i>🤗 ᴛᴏᴛᴀʟ <code>{total}</code> ʀᴇꜱᴜʟᴛꜱ ꜰᴏᴜɴᴅ ɪɴ ᴛʜɪꜱ ɢʀᴏᴜᴘ 👇</i></b>', reply_markup=reply_markup)
else:
await message.reply_text(f'<b><i>📢 ꜱᴇɴᴅ ᴍᴏᴠɪᴇ ᴏʀ ꜱᴇʀɪᴇꜱ ʀᴇǫᴜᴇꜱᴛ ʜᴇʀᴇ 👇</i></b>', reply_markup=reply_markup)
@Client.on_message(filters.group & filters.text & filters.incoming)
async def group_search(client, message):
if not await db.get_chat(message.chat.id):
total = await client.get_chat_members_count(message.chat.id)
username = f'@{message.chat.username}' if message.chat.username else 'Private'
await client.send_message(LOG_CHANNEL, script.NEW_GROUP_TXT.format(message.chat.title, message.chat.id, username, total))
await db.add_chat(message.chat.id, message.chat.title)
settings = await get_settings(message.chat.id)
chatid = message.chat.id
userid = message.from_user.id if message.from_user else None
user_id = message.from_user.id if message.from_user else 0
fsub = settings['fsub'] if not await db.has_premium_access(message.from_user.id) else None
if settings.get('is_fsub', IS_FSUB) and fsub is not None:
try:
btn = await is_subscribed(client, message, int(fsub))
if btn:
btn.append(
[InlineKeyboardButton("Unmute Me 🔕", callback_data=f"unmuteme#{user_id}")]
)
reply_markup = InlineKeyboardMarkup(btn)
try:
await client.restrict_chat_member(chatid, message.from_user.id, ChatPermissions(can_send_messages=False))
await message.reply_photo(
photo=random.choice(PICS),
caption=f"👋 Hello {message.from_user.mention},\n\nPlease join and try again. 😇",
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
return
except Exception as e:
print(e)
else:
pass
except:
pass
else:
pass
if settings["auto_filter"]:
if not userid:
await message.reply("I'm not working for anonymous admin!")
return
if message.chat.id == SUPPORT_GROUP:
files, offset, total = await get_search_results(message.text)
if files:
btn = [[
InlineKeyboardButton("Here", url=FILMS_LINK)
]]
await message.reply_text(f'Total {total} results found in this group', reply_markup=InlineKeyboardMarkup(btn))
return
if message.text.startswith("/"):
return
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('Report sent!' + ''.join(hidden_mentions))
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('Links not allowed here!')
elif '#request' in message.text.lower():
if message.from_user.id in ADMINS:
return
await client.send_message(LOG_CHANNEL, f"#Request\n★ User: {message.from_user.mention}\n★ Group: {message.chat.title}\n\n★ Message: {re.sub(r'#request', '', message.text.lower())}")
await message.reply_text("Request sent!")
return
else:
await auto_filter(client, message)
else:
k = await message.reply_text('Auto Filter Off! ❌')
await asyncio.sleep(5)
await k.delete()
try:
await message.delete()
except:
pass
@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(f"Hello {query.from_user.first_name},\nDon't Click Other Results!", show_alert=True)
try:
offset = int(offset)
except:
offset = 0
search = BUTTONS.get(key)
cap = CAP.get(key)
if not search:
await query.answer(f"Hello {query.from_user.first_name},\nSend New Request Again!", 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[key] = files
settings = await get_settings(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 ''
files_link = ''
if settings['links']:
btn = []
for file_num, file in enumerate(files, start=offset+1):
files_link += 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)}] {file.file_name}</a></b>"""
else:
btn = [[
InlineKeyboardButton(text=f"📂 {get_size(file.file_size)} {file.file_name}", callback_data=f'file#{file.file_id}')
]
for file in files
]
if settings['shortlink']:
btn.insert(0,
[InlineKeyboardButton("♻️ sᴇɴᴅ ᴀʟʟ ♻️", url=await get_shortlink(settings['url'], settings['api'], f'https://t.me/{temp.U_NAME}?start=all_{query.message.chat.id}_{key}')),
InlineKeyboardButton("🥇 ʙᴜʏ 🥇", url=f"https://t.me/{temp.U_NAME}?start=plans"),
InlineKeyboardButton("📰 ʟᴀɴɢᴜᴀɢᴇs 📰", callback_data=f"languages#{key}#{req}#{offset}")]
)
else:
btn.insert(0,
[InlineKeyboardButton("♻️ sᴇɴᴅ ᴀʟʟ ♻️", callback_data=f"send_all#{key}#{req}"),
InlineKeyboardButton("🥇 ʙᴜʏ 🥇", url=f"https://t.me/{temp.U_NAME}?start=plans"),
InlineKeyboardButton("📰 ʟᴀɴɢᴜᴀɢᴇs 📰", callback_data=f"languages#{key}#{req}#{offset}")]
)
if 0 < offset <= MAX_BTN:
off_set = 0
elif offset == 0:
off_set = None
else:
off_set = offset - MAX_BTN
if n_offset == 0:
btn.append(
[InlineKeyboardButton("« ʙᴀᴄᴋ", callback_data=f"next_{req}_{key}_{off_set}"),
InlineKeyboardButton(f"{math.ceil(int(offset) / MAX_BTN) + 1}/{math.ceil(total / MAX_BTN)}", callback_data="buttons")]
)
elif off_set is None:
btn.append(
[InlineKeyboardButton(f"{math.ceil(int(offset) / MAX_BTN) + 1}/{math.ceil(total / MAX_BTN)}", callback_data="buttons"),
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) / MAX_BTN) + 1}/{math.ceil(total / MAX_BTN)}", callback_data="buttons"),
InlineKeyboardButton("ɴᴇxᴛ »", callback_data=f"next_{req}_{key}_{n_offset}")
]
)
btn.append(
[InlineKeyboardButton("🚫 ᴄʟᴏsᴇ 🚫", callback_data="close_data")]
)
try:
await query.message.edit_text(cap + files_link + del_msg, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=True)
except MessageNotModified:
pass
@Client.on_callback_query(filters.regex(r"^languages"))
async def languages_cb_handler(client: Client, query: CallbackQuery):
_, key, req, offset = query.data.split("#")
if int(req) != query.from_user.id:
return await query.answer(f"Hello {query.from_user.first_name},\nDon't Click Other Results!", show_alert=True)
btn = [[
InlineKeyboardButton(text=lang.title(), callback_data=f"lang_search#{lang}#{key}#{offset}#{req}"),
]
for lang in LANGUAGES
]
btn.append([InlineKeyboardButton(text="⪻ ʙᴀᴄᴋ ᴛᴏ ᴍᴀɪɴ ᴘᴀɢᴇ", callback_data=f"next_{req}_{key}_{offset}")])
await query.message.edit_text("<b>ɪɴ ᴡʜɪᴄʜ ʟᴀɴɢᴜᴀɢᴇ ᴅᴏ ʏᴏᴜ ᴡᴀɴᴛ, sᴇʟᴇᴄᴛ ʜᴇʀᴇ</b>", disable_web_page_preview=True, reply_markup=InlineKeyboardMarkup(btn))
@Client.on_callback_query(filters.regex(r"^lang_search"))
async def filter_languages_cb_handler(client: Client, query: CallbackQuery):
_, lang, key, offset, req = query.data.split("#")
if int(req) != query.from_user.id:
return await query.answer(f"Hello {query.from_user.first_name},\nDon't Click Other Results!", show_alert=True)
search = BUTTONS.get(key)
cap = CAP.get(key)
if not search:
await query.answer(f"Hello {query.from_user.first_name},\nSend New Request Again!", show_alert=True)
return
files, l_offset, total_results = await get_search_results(search, lang=lang)
if not files:
await query.answer(f"sᴏʀʀʏ '{lang.title()}' ʟᴀɴɢᴜᴀɢᴇ ꜰɪʟᴇs ɴᴏᴛ ꜰᴏᴜɴᴅ 😕", show_alert=1)
return
temp.FILES[key] = files
settings = await get_settings(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 ''
files_link = ''
if settings['links']:
btn = []
for file_num, file in enumerate(files, start=1):
files_link += 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)}] {file.file_name}</a></b>"""
else:
btn = [[
InlineKeyboardButton(text=f"📂 {get_size(file.file_size)} {file.file_name}", callback_data=f'file#{file.file_id}')
]
for file in files
]
if settings['shortlink']:
btn.insert(0,
[InlineKeyboardButton("♻️ sᴇɴᴅ ᴀʟʟ ♻️", url=await get_shortlink(settings['url'], settings['api'], f'https://t.me/{temp.U_NAME}?start=all_{query.message.chat.id}_{key}')),
InlineKeyboardButton("🥇 ʙᴜʏ 🥇", url=f"https://t.me/{temp.U_NAME}?start=plans")]
)
else:
btn.insert(0,
[InlineKeyboardButton("♻️ sᴇɴᴅ ᴀʟʟ ♻️", callback_data=f"send_all#{key}#{req}"),
InlineKeyboardButton("🥇 ʙᴜʏ 🥇", url=f"https://t.me/{temp.U_NAME}?start=plans")]
)
if l_offset != "":
btn.append(
[InlineKeyboardButton(text=f"1/{math.ceil(int(total_results) / MAX_BTN)}", callback_data="buttons"),
InlineKeyboardButton(text="ɴᴇxᴛ »", callback_data=f"lang_next#{req}#{key}#{lang}#{l_offset}#{offset}")]
)
else:
btn.append(
[InlineKeyboardButton(text="🚸 ɴᴏ ᴍᴏʀᴇ ᴘᴀɢᴇs 🚸", callback_data="buttons")]
)
btn.append([InlineKeyboardButton(text="⪻ ʙᴀᴄᴋ ᴛᴏ ᴍᴀɪɴ ᴘᴀɢᴇ", callback_data=f"next_{req}_{key}_{offset}")])
await query.message.edit_text(cap + files_link + del_msg, disable_web_page_preview=True, reply_markup=InlineKeyboardMarkup(btn))
@Client.on_callback_query(filters.regex(r"^lang_next"))
async def lang_next_page(bot, query):
ident, req, key, lang, l_offset, offset = query.data.split("#")
if int(req) != query.from_user.id:
return await query.answer(f"Hello {query.from_user.first_name},\nDon't Click Other Results!", show_alert=True)
try:
l_offset = int(l_offset)
except:
l_offset = 0
search = BUTTONS.get(key)
cap = CAP.get(key)
settings = await get_settings(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 ''
if not search:
await query.answer(f"Hello {query.from_user.first_name},\nSend New Request Again!", show_alert=True)
return
files, n_offset, total = await get_search_results(search, offset=l_offset, lang=lang)
if not files:
return
temp.FILES[key] = files
try:
n_offset = int(n_offset)
except:
n_offset = 0
files_link = ''
if settings['links']:
btn = []
for file_num, file in enumerate(files, start=l_offset+1):
files_link += 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)}] {file.file_name}</a></b>"""
else:
btn = [[
InlineKeyboardButton(text=f"✨ {get_size(file.file_size)} ⚡️ {file.file_name}", callback_data=f'file#{file.file_id}')
]
for file in files
]
if settings['shortlink']:
btn.insert(0,
[InlineKeyboardButton("♻️ sᴇɴᴅ ᴀʟʟ ♻️", url=await get_shortlink(settings['url'], settings['api'], f'https://t.me/{temp.U_NAME}?start=all_{query.message.chat.id}_{key}')),
InlineKeyboardButton("🥇 ʙᴜʏ 🥇", url=f"https://t.me/{temp.U_NAME}?start=plans")]
)
else:
btn.insert(0,
[InlineKeyboardButton("♻️ sᴇɴᴅ ᴀʟʟ ♻️", callback_data=f"send_all#{key}#{req}"),
InlineKeyboardButton("🥇 ʙᴜʏ 🥇", url=f"https://t.me/{temp.U_NAME}?start=plans"),]
)
if 0 < l_offset <= MAX_BTN:
b_offset = 0
elif l_offset == 0:
b_offset = None
else:
b_offset = l_offset - MAX_BTN
if n_offset == 0:
btn.append(
[InlineKeyboardButton("« ʙᴀᴄᴋ", callback_data=f"lang_next#{req}#{key}#{lang}#{b_offset}#{offset}"),
InlineKeyboardButton(f"{math.ceil(int(l_offset) / MAX_BTN) + 1}/{math.ceil(total / MAX_BTN)}", callback_data="buttons")]
)
elif b_offset is None:
btn.append(
[InlineKeyboardButton(f"{math.ceil(int(l_offset) / MAX_BTN) + 1}/{math.ceil(total / MAX_BTN)}", callback_data="buttons"),
InlineKeyboardButton("ɴᴇxᴛ »", callback_data=f"lang_next#{req}#{key}#{lang}#{n_offset}#{offset}")]
)
else:
btn.append(
[InlineKeyboardButton("« ʙᴀᴄᴋ", callback_data=f"lang_next#{req}#{key}#{lang}#{b_offset}#{offset}"),
InlineKeyboardButton(f"{math.ceil(int(l_offset) / MAX_BTN) + 1}/{math.ceil(total / MAX_BTN)}", callback_data="buttons"),
InlineKeyboardButton("ɴᴇxᴛ »", callback_data=f"lang_next#{req}#{key}#{lang}#{n_offset}#{offset}")]
)
btn.append([InlineKeyboardButton(text="⪻ ʙᴀᴄᴋ ᴛᴏ ᴍᴀɪɴ ᴘᴀɢᴇ", callback_data=f"next_{req}_{key}_{offset}")])
await query.message.edit_text(cap + files_link + del_msg, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=True)
@Client.on_callback_query(filters.regex(r"^spolling"))
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(f"Hello {query.from_user.first_name},\nDon't Click Other Results!", show_alert=True)
movie = await get_poster(id, id=True)
search = movie.get('title')
await query.answer('Check In My Database...')
files, offset, total_results = await get_search_results(search)
if files:
k = (search, files, offset, total_results)
await auto_filter(bot, query, k)
else:
await bot.send_message(LOG_CHANNEL, script.NO_RESULT_TXT.format(query.message.chat.title, query.message.chat.id, query.from_user.mention, search))
k = await query.message.edit(f"👋 Hello {query.from_user.mention},\n\nI don't find <b>'{search}'</b> in my database. 😔")
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(f"Hello {query.from_user.first_name},\nThis Is Not For You!", show_alert=True)
await query.answer("Closed!")
await query.message.delete()
try:
await query.message.reply_to_message.delete()
except:
pass
if query.data.startswith("file"):
ident, file_id = query.data.split("#")
user = query.message.reply_to_message.from_user.id
if int(user) != 0 and query.from_user.id != int(user):
return await query.answer(f"Hello {query.from_user.first_name},\nDon't Click Other Results!", show_alert=True)
await query.answer(url=f"https://t.me/{temp.U_NAME}?start=file_{query.message.chat.id}_{file_id}")
elif query.data.startswith("stream"):
file_id = query.data.split('#', 1)[1]
msg = await client.send_cached_media(chat_id=BIN_CHANNEL, file_id=file_id)
watch = f"{URL}watch/{msg.id}"
download = f"{URL}download/{msg.id}"
btn=[[
InlineKeyboardButton("ᴡᴀᴛᴄʜ ᴏɴʟɪɴᴇ", url=watch),
InlineKeyboardButton("ꜰᴀsᴛ ᴅᴏᴡɴʟᴏᴀᴅ", url=download)
],[
InlineKeyboardButton('❌ ᴄʟᴏsᴇ ❌', callback_data='close_data')
]]
reply_markup=InlineKeyboardMarkup(btn)
await query.edit_message_reply_markup(
reply_markup=reply_markup
)
elif query.data == "get_trail":
user_id = query.from_user.id
free_trial_status = await db.get_free_trial_status(user_id)
if not free_trial_status:
await db.give_free_trail(user_id)
new_text = "**ʏᴏᴜ ᴄᴀɴ ᴜsᴇ ꜰʀᴇᴇ ᴛʀᴀɪʟ ꜰᴏʀ 5 ᴍɪɴᴜᴛᴇs ꜰʀᴏᴍ ɴᴏᴡ 😀\n\nआप अब से 5 मिनट के लिए निःशुल्क ट्रायल का उपयोग कर सकते हैं 😀**"
await query.message.edit_text(text=new_text)
return
else:
new_text= "**🤣 you already used free now no more free trail. please buy subscription here are our 👉 /plans**"
await query.message.edit_text(text=new_text)
return
elif query.data == "buy_premium":
btn = [[
InlineKeyboardButton("✅sᴇɴᴅ ʏᴏᴜʀ ᴘᴀʏᴍᴇɴᴛ ʀᴇᴄᴇɪᴘᴛ ʜᴇʀᴇ✅", user_id=admin)
]
for admin in ADMINS
]
btn.append(
[InlineKeyboardButton("⚠️ᴄʟᴏsᴇ / ᴅᴇʟᴇᴛᴇ⚠️", callback_data="close_data")]
)
reply_markup = InlineKeyboardMarkup(btn)
await query.message.reply_photo(
photo=PAYMENT_QR,
caption="**⚡️Buy Premium Now\n\n ╭━━━━━━━━╮\n Premium Plans\n • ₹10 - 1 day (Trial)\n • ₹25 - 1 Week (Trial)\n • ₹50 - 1 Month\n • ₹120 - 3 Months\n • ₹220 - 6 Months\n • ₹400 - 1 Year\n╰━━━━━━━━╯\n\nPremium Features ♤ᵀ&ᶜ\n\n☆ New/Old Movies and Series\n☆ High Quality available\n☆ Get Files Directly \n☆ High speed Download links\n☆ Full Admin support \n☆ Request will be completed in 1 hour if available.\n\nᴜᴘɪ ɪᴅ ➢ <code>Rishikesh-Sharma09@axl</code>\n\n⚠️Send SS After Payment⚠️\n\n~ After sending a Screenshot please give us some time to add you in the premium version.**",
reply_markup=reply_markup
)
return
elif query.data.startswith("checksub"):
ident, mc = query.data.split("#")
settings = await get_settings(int(mc.split("_", 2)[1]))
btn = await is_subscribed(client, query, settings['fsub'])
if btn:
await query.answer(f"Hello {query.from_user.first_name},\nPlease join my updates channel and try again.", show_alert=True)
btn.append(
[InlineKeyboardButton("🔁 Try Again 🔁", callback_data=f"checksub#{mc}")]
)
await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(btn))
return
await query.answer(url=f"https://t.me/{temp.U_NAME}?start={mc}")
await query.message.delete()
elif query.data.startswith("unmuteme"):
ident, userid = query.data.split("#")
user_id = query.from_user.id
settings = await get_settings(int(query.message.chat.id))
if userid == 0:
await query.answer("You are anonymous admin !", show_alert=True)
return
if userid != user_id:
await query.answer("Not For You ☠️", show_alert=True)
return
btn = await is_subscribed(client, query, settings['fsub'])
if btn:
await query.answer("Kindly Join Given Channel To Get Unmute", show_alert=True)
else:
await client.unban_chat_member(query.message.chat.id, user_id)
await query.answer("Unmuted Successfully !", show_alert=True)
try:
await query.message.delete()
except:
return
elif query.data == "buttons":
await query.answer("⚠️")
elif query.data == "instructions":
await query.answer("Movie request format.\nExample:\nBlack Adam or Black Adam 2022\n\nTV Reries request format.\nExample:\nLoki S01E01 or Loki S01 E01\n\nDon't use symbols.", show_alert=True)
elif query.data == "start":
await query.answer('Welcome!')
buttons = [[
InlineKeyboardButton("+ ᴀᴅᴅ ᴍᴇ ᴛᴏ ʏᴏᴜʀ ɢʀᴏᴜᴘ +", url=f'http://t.me/{temp.U_NAME}?startgroup=start')
],[
InlineKeyboardButton('🔎 sᴇᴀʀᴄʜ ɪɴʟɪɴᴇ 🔍', switch_inline_query_current_chat='')
],[
InlineKeyboardButton('⚡️ ᴜᴘᴅᴀᴛᴇs ᴄʜᴀɴɴᴇʟ ⚡️', url=UPDATES_LINK),
InlineKeyboardButton('💡 Support Group 💡', url=SUPPORT_LINK)
],[
InlineKeyboardButton('👨🚒 ʜᴇʟᴘ', callback_data='help'),
InlineKeyboardButton('📚 ᴀʙᴏᴜᴛ', callback_data='my_about'),
InlineKeyboardButton('👤 ᴏᴡɴᴇʀ', callback_data='my_owner')
],[
InlineKeyboardButton('💰 ᴇᴀʀɴ ᴍᴏɴᴇʏ ʙʏ ʙᴏᴛ 💰', callback_data='earn')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.START_TXT.format(query.from_user.mention, get_wish()),
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "my_about":
buttons = [[
InlineKeyboardButton('📊 sᴛᴀᴛᴜs', callback_data='stats'),
InlineKeyboardButton('🔋 sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ', callback_data='source')
],[
InlineKeyboardButton('« ʙᴀᴄᴋ', callback_data='start')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.MY_ABOUT_TXT,
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "stats":
if query.from_user.id not in ADMINS:
return await query.answer("ADMINS Only!", show_alert=True)
files = await Media.count_documents()
users = await db.total_users_count()
chats = await db.total_chat_count()
premium = await db.all_premium_users()
u_size = get_size(await db.get_db_size())
f_size = get_size(536870912 - await db.get_db_size())
uptime = get_readable_time(time_now() - temp.START_TIME)
buttons = [[
InlineKeyboardButton('« ʙᴀᴄᴋ', callback_data='my_about')
]]
await query.message.edit_text(script.STATUS_TXT.format(files, users, chats, premium, u_size, f_size, uptime), reply_markup=InlineKeyboardMarkup(buttons)
)
elif query.data == "my_owner":
buttons = [[
InlineKeyboardButton(text=f"☎️ ᴄᴏɴᴛᴀᴄᴛ - {(await client.get_users(admin)).first_name}", user_id=admin)
]
for admin in ADMINS
]
buttons.append(
[InlineKeyboardButton('« ʙᴀᴄᴋ', callback_data='start')]
)
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.MY_OWNER_TXT,
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "earn":
buttons = [[
InlineKeyboardButton('‼️ ʜᴏᴡ ᴛᴏ ᴄᴏɴɴᴇᴄᴛ sʜᴏʀᴛɴᴇʀ ‼️', callback_data='howshort')
],[
InlineKeyboardButton('≼ ʙᴀᴄᴋ', callback_data='start')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.EARN_TXT,
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "howshort":
buttons = [[
InlineKeyboardButton('≼ ʙᴀᴄᴋ', callback_data='earn')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.HOW_TXT,
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data == "help":
buttons = [[
InlineKeyboardButton('User Command', callback_data='user_command'),
InlineKeyboardButton('Admin Command', callback_data='admin_command')
],[
InlineKeyboardButton('« ʙᴀᴄᴋ', callback_data='start')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.HELP_TXT,
reply_markup=reply_markup
)
elif query.data == "user_command":
buttons = [[
InlineKeyboardButton('« ʙᴀᴄᴋ', callback_data='help')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.USER_COMMAND_TXT,
reply_markup=reply_markup
)
elif query.data == "admin_command":
if query.from_user.id not in ADMINS:
return await query.answer("ADMINS Only!", show_alert=True)
buttons = [[
InlineKeyboardButton('« ʙᴀᴄᴋ', callback_data='help')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.ADMIN_COMMAND_TXT,
reply_markup=reply_markup
)
elif query.data == "source":
buttons = [[
InlineKeyboardButton('≼ ʙᴀᴄᴋ', callback_data='my_about')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_text(
text=script.SOURCE_TXT,
reply_markup=reply_markup,
parse_mode=enums.ParseMode.HTML
)
elif query.data.startswith("setgs"):
ident, set_type, status, grp_id = query.data.split("#")
userid = query.from_user.id if query.from_user else None
if not await is_check_admin(client, int(grp_id), userid):
await query.answer("This Is Not For You!", show_alert=True)
return
if status == "True":
await save_group_settings(int(grp_id), set_type, False)
await query.answer("❌")
else:
await save_group_settings(int(grp_id), set_type, True)
await query.answer("✅")
settings = await get_settings(int(grp_id))
if settings is not None:
buttons = [[
InlineKeyboardButton('Auto Filter', callback_data=f'setgs#auto_filter#{settings["auto_filter"]}#{grp_id}'),
InlineKeyboardButton('✅ Yes' if settings["auto_filter"] else '❌ No', callback_data=f'setgs#auto_filter#{settings["auto_filter"]}#{grp_id}')
],[
InlineKeyboardButton('IMDb Poster', callback_data=f'setgs#imdb#{settings["imdb"]}#{grp_id}'),
InlineKeyboardButton('✅ Yes' if settings["imdb"] else '❌ No', callback_data=f'setgs#imdb#{settings["imdb"]}#{grp_id}')
],[
InlineKeyboardButton('Spelling Check', callback_data=f'setgs#spell_check#{settings["spell_check"]}#{grp_id}'),
InlineKeyboardButton('✅ Yes' if settings["spell_check"] else '❌ No', callback_data=f'setgs#spell_check#{settings["spell_check"]}#{grp_id}')
],[
InlineKeyboardButton('Auto Delete', callback_data=f'setgs#auto_delete#{settings["auto_delete"]}#{grp_id}'),
InlineKeyboardButton(f'{get_readable_time(DELETE_TIME)}' if settings["auto_delete"] else '❌ No', callback_data=f'setgs#auto_delete#{settings["auto_delete"]}#{grp_id}')
],[
InlineKeyboardButton('Welcome', callback_data=f'setgs#welcome#{settings["welcome"]}#{grp_id}',),
InlineKeyboardButton('✅ Yes' if settings["welcome"] else '❌ No', callback_data=f'setgs#welcome#{settings["welcome"]}#{grp_id}'),
],[
InlineKeyboardButton('Shortlink', callback_data=f'setgs#shortlink#{settings["shortlink"]}#{grp_id}'),
InlineKeyboardButton('✅ Yes' if settings["shortlink"] else '❌ No', callback_data=f'setgs#shortlink#{settings["shortlink"]}#{grp_id}'),
],[
InlineKeyboardButton('Result Page', callback_data=f'setgs#links#{settings["links"]}#{str(grp_id)}'),
InlineKeyboardButton('⛓ Link' if settings["links"] else '🧲 Button', callback_data=f'setgs#links#{settings["links"]}#{str(grp_id)}')
],[
InlineKeyboardButton('Fsub', callback_data=f'setgs#is_fsub#{settings.get("is_fsub", IS_FSUB)}#{str(grp_id)}'),
InlineKeyboardButton('✅ On' if settings.get("is_fsub", IS_FSUB) else '❌ Off', callback_data=f'setgs#is_fsub#{settings.get("is_fsub", IS_FSUB)}#{str(grp_id)}')
],[
InlineKeyboardButton('Stream', callback_data=f'setgs#is_stream#{settings.get("is_stream", IS_STREAM)}#{str(grp_id)}'),
InlineKeyboardButton('✅ On' if settings.get("is_stream", IS_STREAM) else '❌ Off', callback_data=f'setgs#is_stream#{settings.get("is_stream", IS_STREAM)}#{str(grp_id)}')
],[
InlineKeyboardButton('❌ Close ❌', callback_data='close_data')
]]
reply_markup = InlineKeyboardMarkup(buttons)
await query.message.edit_reply_markup(reply_markup)
else:
await query.message.edit_text("Something went wrong!")
elif query.data == "delete_all":
files = await Media.count_documents()
await query.answer('Deleting...')
await Media.collection.drop()
await query.message.edit_text(f"Successfully deleted {files} files")
elif query.data.startswith("delete"):
_, query_ = query.data.split("_", 1)
deleted = 0
await query.message.edit('Deleting...')
total, files = await delete_files(query_)
async for file in files:
await Media.collection.delete_one({'_id': file.file_id})
deleted += 1
await query.message.edit(f'Deleted {deleted} files in your database in your query {query_}')
elif query.data.startswith("send_all"):
ident, key, req = query.data.split("#")
if int(req) != query.from_user.id:
return await query.answer(f"Hello {query.from_user.first_name},\nDon't Click Other Results!", show_alert=True)
files = temp.FILES.get(key)
if not files:
await query.answer(f"Hello {query.from_user.first_name},\nSend New Request Again!", show_alert=True)
return
await query.answer(url=f"https://t.me/{temp.U_NAME}?start=all_{query.message.chat.id}_{key}")
elif query.data == "unmute_all_members":
if not await is_check_admin(client, query.message.chat.id, query.from_user.id):
await query.answer("This Is Not For You!", show_alert=True)
return
users_id = []
await query.message.edit("Unmute all started! This process maybe get some time...")
try:
async for member in client.get_chat_members(query.message.chat.id, filter=enums.ChatMembersFilter.RESTRICTED):
users_id.append(member.user.id)
for user_id in users_id:
await client.unban_chat_member(query.message.chat.id, user_id)
except Exception as e:
await query.message.delete()
await query.message.reply(f'Something went wrong.\n\n<code>{e}</code>')
return
await query.message.delete()
if users_id:
await query.message.reply(f"Successfully unmuted <code>{len(users_id)}</code> users.")
else:
await query.message.reply('Nothing to unmute users.')
elif query.data == "unban_all_members":
if not await is_check_admin(client, query.message.chat.id, query.from_user.id):
await query.answer("This Is Not For You!", show_alert=True)
return
users_id = []
await query.message.edit("Unban all started! This process maybe get some time...")
try:
async for member in client.get_chat_members(query.message.chat.id, filter=enums.ChatMembersFilter.BANNED):
users_id.append(member.user.id)
for user_id in users_id:
await client.unban_chat_member(query.message.chat.id, user_id)
except Exception as e:
await query.message.delete()
await query.message.reply(f'Something went wrong.\n\n<code>{e}</code>')
return
await query.message.delete()
if users_id:
await query.message.reply(f"Successfully unban <code>{len(users_id)}</code> users.")
else:
await query.message.reply('Nothing to unban users.')
elif query.data == "kick_muted_members":
if not await is_check_admin(client, query.message.chat.id, query.from_user.id):
await query.answer("This Is Not For You!", show_alert=True)
return
users_id = []
await query.message.edit("Kick muted users started! This process maybe get some time...")
try:
async for member in client.get_chat_members(query.message.chat.id, filter=enums.ChatMembersFilter.RESTRICTED):
users_id.append(member.user.id)
for user_id in users_id:
await client.ban_chat_member(query.message.chat.id, user_id, datetime.now() + timedelta(seconds=30))
except Exception as e:
await query.message.delete()
await query.message.reply(f'Something went wrong.\n\n<code>{e}</code>')
return
await query.message.delete()
if users_id:
await query.message.reply(f"Successfully kicked muted <code>{len(users_id)}</code> users.")
else:
await query.message.reply('Nothing to kick muted users.')
elif query.data == "kick_deleted_accounts_members":
if not await is_check_admin(client, query.message.chat.id, query.from_user.id):
await query.answer("This Is Not For You!", show_alert=True)
return
users_id = []
await query.message.edit("Kick deleted accounts started! This process maybe get some time...")
try:
async for member in client.get_chat_members(query.message.chat.id):
if member.user.is_deleted:
users_id.append(member.user.id)
for user_id in users_id:
await client.ban_chat_member(query.message.chat.id, user_id, datetime.now() + timedelta(seconds=30))
except Exception as e:
await query.message.delete()
await query.message.reply(f'Something went wrong.\n\n<code>{e}</code>')
return
await query.message.delete()
if users_id:
await query.message.reply(f"Successfully kicked deleted <code>{len(users_id)}</code> accounts.")
else:
await query.message.reply('Nothing to kick deleted accounts.')
elif query.data.startswith("getfile"):
_, file_id, grp_id = query.data.split("#")
if not await db.has_premium_access(query.from_user.id):
protect_content = True
else:
protect_content = False
settings = await get_settings(int(grp_id))
files_ = await get_file_details(file_id)
files = files_[0]
CAPTION = settings['caption']
f_caption = CAPTION.format(
file_name = files.file_name,
file_size = get_size(files.file_size),
file_caption=files.caption
)
if settings.get('is_stream', IS_STREAM):
btn = [[
InlineKeyboardButton("✛ ᴡᴀᴛᴄʜ & ᴅᴏᴡɴʟᴏᴀᴅ ✛", callback_data=f"stream#{file_id}")
],[
InlineKeyboardButton('⚡️ ᴜᴘᴅᴀᴛᴇs ⚡️', url=UPDATES_LINK),
InlineKeyboardButton('💡 ꜱᴜᴘᴘᴏʀᴛ 💡', url=SUPPORT_LINK)
],[
InlineKeyboardButton('⁉️ ᴄʟᴏsᴇ ⁉️', callback_data='close_data')
]]
else:
btn = [[
InlineKeyboardButton('⚡️ ᴜᴘᴅᴀᴛᴇs ⚡️', url=UPDATES_LINK),
InlineKeyboardButton('💡 ꜱᴜᴘᴘᴏʀᴛ 💡', url=SUPPORT_LINK)
],[
InlineKeyboardButton('⁉️ ᴄʟᴏsᴇ ⁉️', callback_data='close_data')
]]
vp = await client.send_cached_media(
chat_id=query.from_user.id,
file_id=file_id,
caption=f_caption,
protect_content=protect_content,
reply_markup=InlineKeyboardMarkup(btn)
)
time = get_readable_time(int(pm_delete_time))
msg = await vp.reply(f"Nᴏᴛᴇ: Tʜɪs ᴍᴇssᴀɢᴇ ᴡɪʟʟ ʙᴇ ᴅᴇʟᴇᴛᴇ ɪɴ {time} ᴛᴏ ᴀᴠᴏɪᴅ ᴄᴏᴘʏʀɪɢʜᴛs. Sᴀᴠᴇ ᴛʜᴇ ғɪʟᴇ ᴛᴏ sᴏᴍᴇᴡʜᴇʀᴇ ᴇʟsᴇ")
await asyncio.sleep(int(pm_delete_time))
btns = [[
InlineKeyboardButton('ɢᴇᴛ ғɪʟᴇ ᴀɢᴀɪɴ', callback_data=f"getfile#{file_id}#{grp_id}")
]]
await msg.delete()
await vp.delete()
await vp.reply("Tʜᴇ ғɪʟᴇ ʜᴀs ʙᴇᴇɴ ɢᴏɴᴇ ! Cʟɪᴄᴋ ɢɪᴠᴇɴ ʙᴜᴛᴛᴏɴ ᴛᴏ ɢᴇᴛ ɪᴛ ᴀɢᴀɪɴ.", reply_markup=InlineKeyboardMarkup(btns))
elif query.data.startswith("getmultifile"):
_, key, grp_id = query.data.split("_")
files = temp.FILES.get(key)
settings = await get_settings(int(grp_id))
if not files:
return await message.reply('No Such All Files Exist!')
for file in files:
CAPTION = settings['caption']
f_caption = CAPTION.format(
file_name = file.file_name,
file_size = get_size(file.file_size),
file_caption=file.caption
)
if settings.get('is_stream', IS_STREAM):
btn = [[
InlineKeyboardButton("✛ ᴡᴀᴛᴄʜ & ᴅᴏᴡɴʟᴏᴀᴅ ✛", callback_data=f"stream#{file.file_id}")
],[
InlineKeyboardButton('⚡️ ᴜᴘᴅᴀᴛᴇs ⚡️', url=UPDATES_LINK),
InlineKeyboardButton('💡 ꜱᴜᴘᴘᴏʀᴛ 💡', url=SUPPORT_LINK)
],[
InlineKeyboardButton('⁉️ ᴄʟᴏsᴇ ⁉️', callback_data='close_data')
]]
else:
btn = [[
InlineKeyboardButton('⚡️ ᴜᴘᴅᴀᴛᴇs ⚡️', url=UPDATES_LINK),
InlineKeyboardButton('💡 ꜱᴜᴘᴘᴏʀᴛ 💡', url=SUPPORT_LINK)
],[
InlineKeyboardButton('⁉️ ᴄʟᴏsᴇ ⁉️', callback_data='close_data')
]]
msg = await client.send_cached_media(
chat_id=query.from_user.id,
file_id=file.file_id,
caption=f_caption,
protect_content=settings['file_secure'],
reply_markup=InlineKeyboardMarkup(btn)
)
file_ids.append(msg.id)
fileids += f"{file.file_id}#"
files_ids = fileids[:-1]
time = get_readable_time(int(pm_delete_time))
vp = await query.message.reply(f"Nᴏᴛᴇ: Tʜɪs ғɪʟᴇs ᴡɪʟʟ ʙᴇ ᴅᴇʟᴇᴛᴇ ɪɴ {time} ᴛᴏ ᴀᴠᴏɪᴅ ᴄᴏᴘʏʀɪɢʜᴛs. Sᴀᴠᴇ ᴛʜᴇ ғɪʟᴇs ᴛᴏ sᴏᴍᴇᴡʜᴇʀᴇ ᴇʟsᴇ")
await asyncio.sleep(int(pm_delete_time))
btns = [[
InlineKeyboardButton('ɢᴇᴛ ғɪʟᴇs ᴀɢᴀɪɴ', callback_data=f"getmultifile_{files_ids}_{grp_id}")
]]
await client.delete_messages(
chat_id=message.chat.id,
message_ids=file_ids
)
await vp.edit("Tʜᴇ ғɪʟᴇs ʜᴀs ʙᴇᴇɴ ɢᴏɴᴇ ! Cʟɪᴄᴋ ɢɪᴠᴇɴ ʙᴜᴛᴛᴏɴ ᴛᴏ ɢᴇᴛ ɪᴛ ᴀɢᴀɪɴ.", reply_markup=InlineKeyboardMarkup(btns))
return
async def auto_filter(client, msg, spoll=False):
if not spoll:
message = msg
settings = await get_settings(message.chat.id)
search = message.text
files, offset, total_results = await get_search_results(search)
if not files:
if settings["spell_check"]:
await advantage_spell_chok(msg)
return
else:
settings = await get_settings(msg.message.chat.id)
message = msg.message.reply_to_message # msg will be callback query
search, files, offset, total_results = spoll
if spoll:
await msg.message.delete()
try:
await message.react(emoji="🔍")
except:
pass
req = message.from_user.id if message.from_user else 0
key = f"{message.chat.id}-{message.id}"
temp.FILES[key] = files
BUTTONS[key] = search
files_link = ""
if settings['links']:
btn = []
for file_num, file in enumerate(files, start=1):
files_link += f"""<b>\n\n{file_num}. <a href=https://t.me/{temp.U_NAME}?start=file_{message.chat.id}_{file.file_id}>[{get_size(file.file_size)}] {file.file_name}</a></b>"""
else:
btn = [[
InlineKeyboardButton(text=f"📂 {get_size(file.file_size)} {file.file_name}", callback_data=f'file#{file.file_id}')
]
for file in files
]
if offset != "":
if settings['shortlink'] and not await db.has_premium_access(message.from_user.id):
btn.insert(0,
[InlineKeyboardButton("♻️ sᴇɴᴅ ᴀʟʟ ♻️", url=await get_shortlink(settings['url'], settings['api'], f'https://t.me/{temp.U_NAME}?start=all_{message.chat.id}_{key}')),
InlineKeyboardButton("🥇 ʙᴜʏ 🥇", url=f"https://t.me/{temp.U_NAME}?start=plans"),
InlineKeyboardButton("📰 ʟᴀɴɢᴜᴀɢᴇs 📰", callback_data=f"languages#{key}#{req}#0")]
)
else:
btn.insert(0,
[InlineKeyboardButton("♻️ sᴇɴᴅ ᴀʟʟ ♻️", callback_data=f"send_all#{key}#{req}"),
InlineKeyboardButton("🥇 ʙᴜʏ 🥇", url=f"https://t.me/{temp.U_NAME}?start=plans"),
InlineKeyboardButton("📰 ʟᴀɴɢᴜᴀɢᴇs 📰", callback_data=f"languages#{key}#{req}#0")]
)
btn.append(
[InlineKeyboardButton(text=f"1/{math.ceil(int(total_results) / MAX_BTN)}", callback_data="buttons"),
InlineKeyboardButton(text="ɴᴇxᴛ »", callback_data=f"next_{req}_{key}_{offset}")]
)
else:
if settings['shortlink'] and not await db.has_premium_access(message.from_user.id):
btn.insert(0,
[InlineKeyboardButton("♻️ sᴇɴᴅ ᴀʟʟ ♻️", url=await get_shortlink(settings['url'], settings['api'], f'https://t.me/{temp.U_NAME}?start=all_{message.chat.id}_{key}')),
InlineKeyboardButton("🥇 ʙᴜʏ 🥇", url=f"https://t.me/{temp.U_NAME}?start=plans")]
)
else:
btn.insert(0,
[InlineKeyboardButton("♻️ sᴇɴᴅ ᴀʟʟ ♻️", callback_data=f"send_all#{key}"),
InlineKeyboardButton("🥇 ʙᴜʏ 🥇", url=f"https://t.me/{temp.U_NAME}?start=plans")]
)
btn.append(
[InlineKeyboardButton(text="🚸 ɴᴏ ᴍᴏʀᴇ ᴘᴀɢᴇs 🚸", callback_data="buttons")]
)
btn.append(
[InlineKeyboardButton("🚫 ᴄʟᴏsᴇ 🚫", callback_data="close_data")]
)
imdb = await get_poster(search, file=(files[0]).file_name) if settings["imdb"] else None
TEMPLATE = settings['template']
if imdb:
cap = TEMPLATE.format(
query=search,
title=imdb['title'],
votes=imdb['votes'],
aka=imdb["aka"],
seasons=imdb["seasons"],
box_office=imdb['box_office'],
localized_title=imdb['localized_title'],
kind=imdb['kind'],
imdb_id=imdb["imdb_id"],
cast=imdb["cast"],
runtime=imdb["runtime"],
countries=imdb["countries"],
certificates=imdb["certificates"],
languages=imdb["languages"],
director=imdb["director"],
writer=imdb["writer"],
producer=imdb["producer"],
composer=imdb["composer"],
cinematographer=imdb["cinematographer"],
music_team=imdb["music_team"],
distributors=imdb["distributors"],