-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbot.lua
More file actions
1398 lines (1357 loc) · 52.4 KB
/
bot.lua
File metadata and controls
1398 lines (1357 loc) · 52.4 KB
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
-------- @RekhneSecurity
URL = require "socket.url"
http = require "socket.http"
https = require "ssl.https"
ltn12 = require "ltn12"
serpent = require ("serpent")
db = require('redis')
redis = db.connect('127.0.0.1', 6379)
JSON = require('dkjson')
tdcli = dofile("tdcli.lua")
utf8 = dofile('utf8.lua')
db = dofile('database.lua')
http.TIMEOUT = 10
local bot_id = 300162673
sudo_users = {300162673}
function is_sudo(msg)
local var = false
for v,user in pairs(sudo_users) do
if user == msg.sender_user_id_ then
var = true
end
end
return var
end
function sleep(n)
os.execute("sleep " .. tonumber(n))
end
function is_muted(user_id, chat_id)
local var = false
local hash = 'Self:Muted:'..chat_id
local banned = redis:sismember(hash, user_id)
if banned then
var = true
end
return var
end
function is_fosh(msg)
local user_id = msg.sender_user_id_
local enemy = redis:sismember('enemy:',user_id)
if enemy then
return true
end
if not enemy then
return false
end
end
-------------------------------------------------------------------------------------------------------
function deleteMessagesFromUser(chat_id, user_id)
tdcli_function ({
ID = "DeleteMessagesFromUser",
chat_id_ = chat_id,
user_id_ = user_id
}, dl_cb, nil)
end
-------------------------------------------------------------------------
----------------------------------------------------------------------------
function sendMessage(chat_id, reply_to_message_id, disable_notification, text, disable_web_page_preview, parse_mode,msg)
local TextParseMode = getParseMode(parse_mode)
local entities = {}
if msg and text:match('<user>') and text:match('<user>') then
local x = string.len(text:match('(.*)<user>'))
local offset = x
local y = string.len(text:match('<user>(.*)</user>'))
local length = y
text = text:gsub('<user>','')
text = text:gsub('</user>','')
table.insert(entities,{ID="MessageEntityMentionName", offset_=0, length_=2, user_id_=234458457})
end
tdcli_function ({
ID = "SendMessage",
chat_id_ = chat_id,
reply_to_message_id_ = reply_to_message_id,
disable_notification_ = disable_notification,
from_background_ = 1,
reply_markup_ = nil,
input_message_content_ = {
ID = "InputMessageText",
text_ = text,
disable_web_page_preview_ = disable_web_page_preview,
clear_draft_ = 0,
entities_ = entities,
parse_mode_ = TextParseMode,
},
}, dl_cb, nil)
end
------------------------------------------------------------------------
local getUser = function(user_id, cb)
tdcli_function({ID = "GetUser", user_id_ = user_id}, cb, nil)
end
local delete_msg = function(chatid, mid)
tdcli_function({
ID = "DeleteMessages",
chat_id_ = chatid,
message_ids_ = mid
}, dl_cb, nil)
end
--------------------------------------------------------------------------
function SendMetion(chat_id, user_id, msg_id, text, offset, length)
local tt = redis:get('endmsg') or ''
tdcli_function ({
ID = "SendMessage",
chat_id_ = chat_id,
reply_to_message_id_ = msg_id,
disable_notification_ = 0,
from_background_ = 1,
reply_markup_ = nil,
input_message_content_ = {
ID = "InputMessageText",
text_ = text..'\n\n'..tt,
disable_web_page_preview_ = 1,
clear_draft_ = 0,
entities_ = {[0]={
ID="MessageEntityMentionName",
offset_=offset,
length_=length,
user_id_=user_id
},
},
},
}, dl_cb, nil)
end
------------------------------------------------------------------------------------------------
function string:starts(text)
return text == string.sub(self, 1, string.len(text))
end
------------------------------------------------------------------------------------------------
function vardump(value)
print(serpent.block(value, {comment=false}))
end
function run(data,edited_msg)
local msg = data.message_
if edited_msg then
msg = data
end
-- vardump(msg)
local chat_id = tostring(msg.chat_id_)
local user_id = msg.sender_user_id_
local reply_id = msg.reply_to_message_id_
local caption = msg.content_.caption_
function is_added(msg)
local var = false
if redis:sismember("sgpsss:",chat_id) then
var = true
end
return var
end
if msg.chat_id_ then
local id = tostring(msg.chat_id_)
if id:match('-100(%d+)') then
chat_type = 'super'
elseif id:match('^(%d+)') then
chat_type = 'user'
else
chat_type = 'group'
end
end
local input = msg.content_.text_
if input and input:match('[QWERTYUIOPASDFGHJKLZXCVBNM]') then
input = input:lower()
end
if msg.content_.ID == "MessageText" then
Type = 'text'
if Type == 'text' and input and input:match('^[/#!]') then
input = input:gsub('^[/!#]','')
end
end
if not redis:get("typing") then
ty = '#Disable'
else
ty = '#Enable'
end
if not redis:get("markread:") then
md = '#Disable'
else
md = '#Enable'
end
if not redis:get("poker"..chat_id) then
pr = '#Disable'
else
pr = '#Enable'
end
if redis:get('autoleave:ultracreed') == "off" then
at = '#Disable'
else
at = '#Enable'
end
if not redis:get("echo:"..chat_id) then
eo = '#Disable'
else
eo = '#Enable'
end
local id = tostring(chat_id)
if id:match("-100") then
grouptype = "supergroup"
if not redis:sismember("sgpss:", chat_id) then
redis:sadd("sgpss:",chat_id)
end
elseif id:match("-") then
grouptype = "group"
if not redis:sismember("gps:", chat_id) then
redis:sadd("gps:",chat_id)
end
elseif id:match("") then
grouptype = "pv"
if not redis:sismember("pv:", chat_id) then
redis:sadd("pv:",chat_id)
end
end
redis:incr("allmsg:")
if is_muted(msg.sender_user_id_, msg.chat_id_) then
local id = msg.id_
local msgs = {[0] = id}
local chat = msg.chat_id_
tdcli.deleteMessages(chat,msgs)
return
end
if redis:get('bot:muteall'..msg.chat_id_) and not is_sudo(msg) then
local id = msg.id_
local msgs = {[0] = id}
local chat = msg.chat_id_
tdcli.deleteMessages(chat,msgs)
return
end
if not is_added(msg) then
redis:setex('time:to:leave'..chat_id, 20, true)
if redis:get('autoleave:ultracreed') == "on" and redis:get('time:to:leave'..chat_id) then
if chat_id:match('-100(%d+)') then
if msg and not is_sudo(msg) then
tdcli.sendText(chat_id , msg.id_, 0, 1, nil, "bay", 1, 'md')
tdcli.changeChatMemberStatus(chat_id, tonumber(bot_id), 'Left')
end
end
end
end
if redis:get("echo:"..chat_id) then
tdcli.forwardMessages(chat_id, chat_id,{[0] = msg.id_}, 0)
end
if msg.content_.text_ then
if input:match("^self on$") and is_sudo(msg) then
if redis:get("bot_on") then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Self Bot Has Been Online Now !*', 1, 'md')
redis:del("bot_on", true)
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *The Self Bot Already On !*', 1, 'md')
end
end
if input:match("^ping$") or input:match("^Ping$") and is_sudo(msg) then
redis:sadd("sgpsss:",chat_id)
tdcli.editMessageText(chat_id, msg.id_, nil, '@RekhneSecurity', 1, 'md')
end
if input:match("^self off$") and is_sudo(msg) then
if not redis:get("bot_on") then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Self Bot Has Been Offline Now !*', 1, 'md')
redis:set("bot_on", true)
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *The Self Bot Already Off !*', 1, 'md')
end
end
if input:match("^add$") or input:match("^اددی$") or input:match("^اددی پی باش$") and is_sudo(msg) and tonumber(msg.reply_to_message_id_) > 0 then
function contact(a,b,c)
if b.content_.ID == 'MessageContact' then
tdcli.importContacts( b.content_.contact_.phone_number_, b.content_.contact_.first_name_, (b.content_.contact_.last_name_ or ''), 0)
end
end
tdcli.getMessage(msg.chat_id_, tonumber(msg.reply_to_message_id_),contact)
end
if input:match('^autoleave on$') then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Autoleave Has Been Enable !*', 1, 'md')
redis:set('autoleave:ultracreed', "on")
end
if input:match('^autoleave off$') then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Autoleave Has Been Disable !*', 1, 'md')
redis:set('autoleave:ultracreed', "off")
end
if not redis:get("bot_on") then
if is_fosh(msg) and not is_sudo(msg) then
tdcli.sendChatAction(chat_id,'Typing')
local data = {
"کس کش",
"کس ننه",
"کص ننت",
"کس خواهر",
"کس خوار",
"کس خارت",
"کس ابجیت",
"کص لیس",
"ساک بزن",
"تخخخخخخخخخ",
"ساک مجلسی",
"ننه الکسیس",
"نن الکسیس",
"ناموستو گاییدم",
"ننه زنا",
"😂😂😂",
"کس خل",
"کس مخ",
"کس مغز",
"کس مغذ",
"خوارکس",
"خوار کس",
"خواهرکس",
"خواهر کس",
"حروم زاده",
"تخخخخخخخخخ",
"حرومزاده",
"خار کس",
"تخم سگ",
"پدر سگ",
"😂😂😂",
"پدرسگ",
"پدر صگ",
"پدرصگ",
"ننه سگ",
"نن سگ",
"نن صگ",
"ننه صگ",
"ننه خراب",
"تخخخخخخخخخ",
"نن خراب",
"مادر سگ",
"مادر خراب",
"مادرتو گاییدم",
"تخم جن",
"تخم سگ",
"😂😂😂",
"مادرتو گاییدم",
"ننه حمومی",
"نن حمومی",
"نن گشاد",
"ننه گشاد",
"نن خایه خور",
"تخخخخخخخخخ",
"نن ممه",
"کس عمت",
"کس کش",
"کس بیبیت",
"کص عمت",
"😂😂😂",
"کص خالت",
"کس بابا",
"کس خر",
"کس کون",
"کس مامیت",
"کس مادرن",
"مادر کسده",
"خوار کسده",
"تخخخخخخخخخ",
"ننه کس",
"بیناموس",
"بی ناموس",
"شل ناموس",
"😂😂😂",
"سگ ناموس",
"ننه جندتو گاییدم باو ",
"چچچچ نگاییدم سیک کن پلیز D:",
"ننه حمومی",
"چچچچچچچ",
"😂😂😂",
"لز ننع",
"ننه الکسیس",
"کص ننت",
"بالا باش",
"تخخخخخخخخخ",
"ننت رو میگام",
"کیرم از پهنا تو کص ننت",
"مادر کیر دزد",
"ننع حرومی",
"تونل تو کص ننت",
"کیرم تو کص ننت",
"کص خوار بدخواه",
"خوار کصده",
"ننع باطل",
"حروم لقمع",
"تخخخخخخخخخ",
"ننه سگ ناموس",
"منو ننت شما همه چچچچ",
"ننه کیر قاپ زن",
"ننع اوبی",
"چچچچچچچ",
"ننه کیر دزد",
"ننه کیونی",
"ننه کصپاره",
"زنا زادع",
"کیر سگ تو کص نتت پخخخ",
"ولد زنا",
"ننه خیابونی",
"هیس بع کس حساسیت دارم",
"کص نگو ننه سگ که میکنمتتاااا",
"کص نن جندت",
"چچچچچ",
"ننه سگ",
"ننه کونی",
"ننه زیرابی",
"بکن ننتم",
"تخخخخخخخخخ",
"ننع فاسد",
"ننه ساکر",
"کس ننع بدخواه",
"نگاییدم",
"😂😂😂",
"مادر سگ",
"ننع شرطی",
"گی ننع",
"بابات شاشیدتت چچچچچچ",
"ننه ماهر",
"حرومزاده",
"ننه کص",
"کص ننت باو",
"پدر سگ",
"سیک کن کص ننت نبینمت",
"کونده",
"ننه ولو",
"تخخخخخخخخخ",
"ننه سگ",
"مادر جنده",
"کص کپک زدع",
"چچچچچچچچ",
"ننع لنگی",
"ننه خیراتی",
"سجده کن سگ ننع",
"ننه خیابونی",
"ننه کارتونی",
"تخخخخخخخخخ",
"تکرار میکنم کص ننت",
"تلگرام تو کس ننت",
"کص خوارت",
"خوار کیونی",
"😂😂😂",
"پا بزن چچچچچ",
"مادرتو گاییدم",
"گوز ننع",
"کیرم تو دهن ننت",
"ننع همگانی",
"😂😂😂",
"کیرم تو کص زیدت",
"کیر تو ممهای ابجیت",
"ابجی سگ",
"چچچچچچچچچ",
"کس دست ریدی با تایپ کردنت چچچ",
"ابجی جنده",
"تخخخخخخخخخ",
"ننع سگ سیبیل",
"بده بکنیم چچچچ",
"کص ناموس",
"شل ناموس",
"ریدم پس کلت چچچچچ",
"ننه شل",
"ننع قسطی",
"ننه ول",
"تخخخخخخخخخ",
"دست و پا نزن کس ننع",
"ننه ولو",
"خوارتو گاییدم",
"محوی!؟",
"😂😂😂",
"ننت خوبع!؟",
"کس زنت",
"شاش ننع",
"ننه حیاطی /:",
"نن غسلی",
"کیرم تو کس ننت بگو مرسی چچچچ",
"چچچچچچ",
"ابم تو کص ننت :/",
"فاک یور مادر خوار سگ پخخخ",
"کیر سگ تو کص ننت",
"کص زن",
"ننه فراری",
"بکن ننتم من باو جمع کن ننه جنده /:::",
"تخخخخخخخخخ",
"ننه جنده بیا واسم ساک بزن",
"حرف نزن که نکنمت هااا :|",
"کیر تو کص ننت😐",
"کص کص کص ننت😂",
"کصصصص ننت جووون",
"سگ ننع",
"😂😂😂",
"کص خوارت",
"کیری فیس",
"کلع کیری",
"تیز باش سیک کن نبینمت",
"فلج تیز باش چچچ",
"تخخخخخخخخخ",
"بیا ننتو ببر",
"بکن ننتم باو ",
"کیرم تو بدخواه",
"چچچچچچچ",
"ننه جنده",
"ننه کص طلا",
"ننه کون طلا",
"😂😂😂",
"کس ننت بزارم بخندیم!؟",
"کیرم دهنت",
"مادر خراب",
"ننه کونی",
"هر چی گفتی تو کص ننت خخخخخخخ",
"کص ناموست بای",
"کص ننت بای ://",
"کص ناموست باعی تخخخخخ",
"کون گلابی!",
"ریدی آب قطع",
"کص کن ننتم کع",
"نن کونی",
"نن خوشمزه",
"ننه لوس",
" نن یه چشم ",
"😂😂😂",
"ننه چاقال",
"ننه جینده",
"ننه حرصی ",
"نن لشی",
"ننه ساکر",
"نن تخمی",
"ننه بی هویت",
"نن کس",
"نن سکسی",
"تخخخخخخخخخ",
"نن فراری",
"لش ننه",
"سگ ننه",
"شل ننه",
"ننه تخمی",
"ننه تونلی",
"😂😂😂",
"ننه کوون",
"نن خشگل",
"نن جنده",
"نن ول ",
"نن سکسی",
"نن لش",
"کس نن ",
"تخخخخخخخخخ",
"نن کون",
"نن رایگان",
"نن خاردار",
"ننه کیر سوار",
"نن پفیوز",
"نن محوی",
"ننه بگایی",
"ننه بمبی",
"ننه الکسیس",
"نن خیابونی",
"نن عنی",
"😂😂😂",
"نن ساپورتی",
"نن لاشخور",
"ننه طلا",
"ننه عمومی",
"ننه هر جایی",
"نن دیوث",
"تخخخخخخخخخ",
"نن ریدنی",
"نن بی وجود",
"ننه سیکی",
"ننه کییر",
"نن گشاد",
"😂😂😂",
"نن پولی",
"نن ول",
"نن هرزه",
"نن دهاتی",
"ننه ویندوزی",
"نن تایپی",
"نن برقی",
"😂😂😂",
"نن شاشی",
"ننه درازی",
"شل ننع",
"یکن ننتم که",
"کس خوار بدخواه",
"آب چاقال",
"ننه جریده",
"چچچچچچچ",
"تخخخخخخخخخ",
"ننه سگ سفید",
"آب کون",
"ننه 85",
"ننه سوپری",
"بخورش",
"کس ننع",
"😂😂😂",
"خوارتو گاییدم",
"خارکسده",
"گی پدر",
"آب چاقال",
"زنا زاده",
"زن جنده",
"سگ پدر",
"مادر جنده",
"تخخخخخخخخخ",
"ننع کیر خور",
"😂😂😂",
"چچچچچ",
"تیز بالا",
"😂😂",
"ننه سگو با کسشر در میره",
"کیر سگ تو کص ننت",
}
tdcli.sendText(chat_id , msg.id_, 0, 1, nil, data[math.random(#data)], 1, 'md')
end
if input:match("^setenemy$") and reply_id and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
function setenemy_reply(extra, result, success)
if redis:sismember("enemy:", result.sender_user_id_) then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *This User Already Is Enemy !*', 1, 'md')
else
redis:sadd("enemy:", result.sender_user_id_) tdcli.editMessageText(chat_id, msg.id_, nil, '> User : <user>'.. result.sender_user_id_ ..'</user> Has Been Set To Enemy Users !', 1, nil, result.sender_user_id_ )
end
end
tdcli.getMessage(chat_id,msg.reply_to_message_id_,setenemy_reply,nil)
elseif input:match("^setenemy @(.*)$") and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
function setenemy_username(extra, result, success)
if result.id_ then
if redis:sismember('enemy:', result.id_) then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *This User Already Is Enemy !*', 1, 'md')
else
redis:sadd("enemy:", result.id_)
tdcli.editMessageText(chat_id, msg.id_, nil, '> User : <user>'..result.id_..'</user> Has Been Set To Enemy Users !', 1, nil)
end
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *User Not Found *', 1, 'md')
end
end
tdcli.searchPublicChat(input:match("^setenemy @(.*)$"),setenemy_username)
elseif input:match("^setenemy (%d+)$") and is_sudo(msg) then
tdcli.sendChatAction(chat_id,'Typing')
if redis:sismember('enemy:', input:match("^setenemy (%d+)$")) then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *This User Already Is Enemy !*', 1, 'md')
else
redis:sadd('enemy:', input:match("^setenemy (%d+)$"))
tdcli.editMessageText(chat_id, msg.id_, nil, '> User : <user>'..input:match("^setenemy (%d+)$")..'</user> Has Been Set To Enemy Users !', 1, nil)
end
end
if input:match("^delenemy$") and reply_id and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
function remenemy_reply(extra, result, success)
if not redis:sismember("enemy:", result.sender_user_id_) then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *This Is Not A Enemy Users !*', 1, nil)
else
redis:srem("enemy:", result.sender_user_id_)
tdcli.editMessageText(chat_id, msg.id_, nil, '> User : <user>'..result.sender_user_id_..'</user> Removed From Enemy Users !', 1, nil)
end
end
tdcli.getMessage(chat_id,msg.reply_to_message_id_,remenemy_reply,nil)
elseif input:match("^delenemy @(.*)$") and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
function remenemy_username(extra, result, success)
if result.id_ then
if not redis:sismember('enemy:', result.id_) then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *This Is Not A Enemy Users !*', 1, nil)
else
redis:srem('enemy:', result.id_)
tdcli.editMessageText(chat_id, msg.id_, nil, '> User : <user>'..result.id_..'</user> Removed From Enemy Users !', 1, nil)
end
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *User Not Found *', 1, 'md')
end
end
tdcli.searchPublicChat(input:match("^delenemy @(.*)$"),remenemy_username)
elseif input:match("^delenemy (%d+)$") and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
if not redis:sismember('enemy:', input:match("^delenemy (%d+)$")) then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *This Is Not A Enemy Users !*', 1, 'md')
else
redis:srem('enemy:', input:match("^delenemy (%d+)$"))
tdcli.editMessageText(chat_id, msg.id_, nil, '> User : <user>'..input:match("^delenemy (%d+)$")..'</user> Removed From Enemy Users !', 1, nil)
end
elseif input:match("^enemylist$") and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
local text = "*Enemy List :*\n\n"
for k,v in pairs(redis:smembers('enemy:')) do
text = text.."*"..k.."* - `"..v.."`\n"
end
tdcli.editMessageText(chat_id, msg.id_, nil, text, 1, 'md')
elseif input:match("^clean enemylist$") and is_sudo(msg) then
redis:del('enemy:')
tdcli.editMessageText(chat_id, msg.id_, nil, '*Done ...!*\n*Enemy List Has Been Removed.*', 1, 'md')
end
if input:match("^inv$") and reply_id and is_sudo(msg) then
function inv_reply(extra, result, success)
tdcli.addChatMember(chat_id, result.sender_user_id_, 20)
end tdcli.getMessage(chat_id,msg.reply_to_message_id_,inv_reply,nil)
elseif input:match("^inv @(.*)$") and is_sudo(msg) then
function inv_username(extra, result, success)
if result.id_ then
tdcli.addChatMember(chat_id, result.id_, 20)
else
tdcli.editMessageText(chat_id, msg.id_, nil,'*User Not Found :(*', 1, 'md')
end
end
tdcli.searchPublicChat(input:match("^inv @(.*)$"),inv_username)
elseif input:match("^inv (%d+)$") and is_sudo(msg) then
tdcli.addChatMember(chat_id, input:match("^inv @(.*)$"), 20)
end
if input:match("^kick$") and reply_id and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
function kick_reply(extra, result, success)
tdcli.changeChatMemberStatus(chat_id, result.sender_user_id_, 'Kicked')
tdcli.editMessageText(chat_id, msg.id_, nil, '> *User :* `'..result.sender_user_id_..'` *Has Been Kicked !*', 1, 'md')
end tdcli.getMessage(chat_id,msg.reply_to_message_id_,kick_reply,nil)
elseif input:match("^kick @(.*)$") and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
function kick_username(extra, result, success)
if result.id_ then
tdcli.changeChatMemberStatus(chat_id, result.id_, 'Kicked')
tdcli.editMessageText(chat_id, msg.id_, nil, '> *User :* `'..result.id_..'` *Has Been Kicked !*', 1, 'md')
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *User Not Found :(*', 1, 'html')
end
end
tdcli.searchPublicChat(input:match("^kick @(.*)$"),kick_username)
elseif input:match("^kick (%d+)$") and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
tdcli.changeChatMemberStatus(chat_id, input:match("^kick (%d+)$"), 'Kicked')
tdcli.editMessageText(chat_id, msg.id_, nil, '> *User :* `'..input:match("^kick (%d+)$")..'` *Has Been Kicked !*', 1, 'md')
end
if input:match("^typing on$") and is_sudo(msg) then
if not redis:get("typing") then
redis:set("typing", true)
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Typing Mode Has Been Turned on !*', 1, 'md')
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Typing Mode Is Already On !*', 1, 'md')
end
end
if input:match("^typing off$") and is_sudo(msg) then
if redis:get("typing") then
redis:del("typing", true)
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Typing Mode Has Been Off !*', 1, 'md')
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Typing Mode Is Already Off !*', 1, 'md')
end
end
if redis:get("typing") then
tdcli.sendChatAction(chat_id,'Typing')
end
if input:match("^markread on$") and is_sudo(msg) then
if not redis:get("markread:") then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *MarkRead Has Been On !*', 1, 'md')
redis:set("markread:", true)
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *MarkRead Is Already On !*', 1, 'md')
end
end
if input:match("^markread off$") and is_sudo(msg) then
if redis:get("markread:") then
tdcli.editMessageText(chat_id, msg.id_, nil, '> *MarkRead Has Been Off Now !*', 1, 'md')
redis:del("markread:", true)
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *MarkRead Is Already Off !*', 1, 'md')
end
end
if redis:get("markread:") then
tdcli.viewMessages(chat_id, {[0] = msg.id_})
end
if input:match("^poker on$") and is_sudo(msg) then
if not redis:get("poker"..chat_id) then
redis:set("poker"..chat_id, true)
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Poker Msg Has Been Enable !*', 1, 'md')
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Poker Msg Is Already Enable !*', 1, 'md')
end
end
if input:match('^(.*) @(.*)$') then
if is_sudo(msg) then
local apen = {
string.match(input, '^(.*) @(.*)$')}
local text = apen[1]
local m_username = function(extra, result)
if result.id_ then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
SendMetion(msg.chat_id_, result.id_, msg.id_, text, 0, utf8.len(text))
end
end
tdcli.searchPublicChat(apen[2],m_username)
end
end
if input:match("^poker off$") and is_sudo(msg) then
if redis:get("poker"..chat_id) then
redis:del("poker"..chat_id, true)
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Poker Msg Has Been Disable !*', 1, 'md')
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Poker Msg Is Already Disable !*', 1, 'md')
end
end
if redis:get("poker"..chat_id) then
if input:match("^😐$") and not is_sudo(msg) and not redis:get("time_poker"..user_id) then
local text = '😐'
SendMetion(msg.chat_id_, msg.sender_user_id_, msg.id_, text, 0, 4)
redis:setex("time_poker"..user_id, 4, true)
end
end
if input:match("^left$") and is_sudo(msg) then
redis:srem("sgpsss:",chat_id)
tdcli.editMessageText(chat_id, msg.id_, nil, '*Done ...!*', 1, 'md')
tdcli.changeChatMemberStatus(chat_id, user_id, 'Left')
end
if input:match('^(setanswer) "(.*)" "(.*)"$') then
local ans = {string.match(input, '^(setanswer) "(.*)" "(.*)"$')}
redis:hset("answer", ans[2], ans[3])
text = "<b>Your Text for Command : "..ans[2].." Has been Successfully Set !</b>"
tdcli.editMessageText(chat_id, msg.id_, nil, text, 1, 'html')
end
if input:match("^(delanswer) (.*)") then
local matches = input:match("^delanswer (.*)")
redis:hdel("answer", matches)
text = "<b>Your Text for Command : "..matches.." Has been Removed !</b>"
tdcli.editMessageText(chat_id, msg.id_, nil, text, 1, 'html')
end
if input:match("^answerlist$") and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
local text = "*Answer List :*\n\n"
for k,v in pairs(redis:hkeys("answer")) do
local value = redis:hget("answer", v)
text = text..""..k.."- "..v.." => "..value.."\n"
end
tdcli.editMessageText(chat_id, msg.id_, nil, text, 1, 'md')
end
if input:match("^clean answerlist$") and is_sudo(msg) then
redis:del("answer")
tdcli.editMessageText(chat_id, msg.id_, nil, '*Done ...!*\n*Answer List Has Been Removed.*', 1, 'md')
end
if input:match("^answer on$") and is_sudo(msg) then
if not redis:get("autoanswer") then
redis:set("autoanswer", true)
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Answer Has Been Enable !*', 1, 'md')
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Answer Is Already Enable !*', 1, 'md')
end
end
if input:match("^answer off$") and is_sudo(msg) then
if redis:get("autoanswer") then
redis:del("autoanswer")
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Answer Has Been Disable !*', 1, 'md')
else
tdcli.editMessageText(chat_id, msg.id_, nil, '> *Answer Is Already Disable !*', 1, 'md')
end
end
if redis:get("autoanswer") then
if msg.sender_user_id_ ~= bot_id then
local names = redis:hkeys("answer")
for i=1, #names do
if input == names[i] then
local value = redis:hget("answer", names[i])
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, value, 1, 'md')
end
end
end
end
if input:match("^myid$") and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
tdcli.editMessageText(chat_id, msg.id_, nil, '`'..user_id..'`', 1, 'md')
elseif input:match("^id$") and reply_id ~= 0 and is_sudo(msg) then
tdcli.sendChatAction(msg.chat_id_,'Typing')
function id_reply(extra, result, success)
tdcli.editMessageText(chat_id, msg.id_, nil, '`'..result.sender_user_id_..'`', 1, 'md')
end
tdcli.getMessage(chat_id,msg.reply_to_message_id_,id_reply,nil)
elseif input:match("^id @(.*)$") and is_sudo(msg) then
function id_username(extra, result, success)
if result.id_ then
tdcli.editMessageText(chat_id, msg.id_, nil, '`'..result.id_..'`', 1, 'md')
else
tdcli.editMessageText(chat_id, msg.id_, nil, '*User Not Found :(*', 1, 'md')
end
end
tdcli.searchPublicChat(input:match("^id @(.*)$"),id_username)
end
if input:lower() == 'cm' and is_sudo(msg) then
x = 0
while x < 4 do
function cleanmembers(extra, result, success)
print(serpent.block(result,{comment=false}))
for k, v in pairs(result.members_) do
local members = v.user_id_
if members ~= bot_id then
tdcli.changeChatMemberStatus(chat_id, v.user_id_, 'Kicked')
print("kicked all members")
end
end
end
tdcli.getChannelMembers(chat_id, "Recent", 0, 200, cleanmembers, nil)
x = x + 1
end
end
if input:match("^cmsg$") and is_sudo(msg) then
local rm = 1000
local function del_msg(extra, result, success)
for k, v in pairs(result.messages_) do
tdcli.deleteMessages(msg.chat_id_,{[0] = v.id_})
end
end
tdcli.getChatHistory(msg.chat_id_, 0, 0, tonumber(rm), del_msg, nil)
end
if input:match("^cmsg$") and is_sudo(msg) then
function cms(extra, result, success)
for k, v in pairs(result.members_) do
deleteMessagesFromUser(chat_id, v.user_id_)
end
tdcli.editMessageText(chat_id, msg.id_, nil, 'All Msg Cleaned', 1, 'md')
end
tdcli.getChannelMembers(chat_id, "Recent", 0, 2000, cms, nil)
tdcli.getChannelMembers(chat_id, "Administrators", 0, 2000, cms, nil)
tdcli.getChannelMembers(chat_id, "Bots", 0, 2000, cms, nil)
tdcli.getChannelMembers(chat_id, "Kicked", 0, 2000, cms, nil)
end
if input:match("^sos$") and is_sudo(msg) then
tdcli.addChatMember(chat_id, 309573480, 0)
tdcli.addChatMember(chat_id, 194849320, 0)
tdcli.addChatMember(chat_id, 114900277, 0)
tdcli.addChatMember(chat_id, 449389567, 0)
tdcli.addChatMember(chat_id, 309573480, 0)
tdcli.addChatMember(chat_id, 276281882, 0)
tdcli.addChatMember(chat_id, 399574034, 0)
tdcli.addChatMember(chat_id, 388551242, 0)
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
if input:match("^(.*)$") and is_is_sudo(msg) then
for i=1, 30 do
tdcli.forwardMessages(chat_id, chat_id,{[0] = msg.id_}, 0)
end
end
if input:match("^echo on$") and is_sudo(msg) then
if redis:get("echo:"..chat_id) then
tdcli.editMessageText(chat_id, msg.id_, nil,'*Text Repeat Mode Was Enabled*',1,'md')
else
redis:set("echo:"..chat_id, true)
tdcli.editMessageText(chat_id, msg.id_, nil,'*Text Repeat Mode Enabeled*',1,'md')
end
elseif input:match("^echo off$") and is_sudo(msg) then
if not redis:get("echo:"..chat_id) then
tdcli.editMessageText(chat_id, msg.id_, nil,'*Text Repeat Mode Was Disabled*',1,'md')
else
redis:del("echo:"..chat_id)
tdcli.editMessageText(chat_id, msg.id_, nil,'*Text Repeat Mode Disabled*',1,'md')
end
end
if input:match("^del (%d+)") then
local rm = tonumber(input:match("^del (%d+)"))
if is_sudo(msg) then
if rm < 101 then
local function del_msg(extra, result, success)
local num = 0
local message = result.messages_
for i=0 , #message do
num = num + 1
tdcli.deleteMessages(msg.chat_id_,{[0] = message[i].id_})
end
tdcli.editMessageText(chat_id, msg.id_, nil, '#Done\n`'..num..'` *Msgs Has Been Cleared.*', 1, 'md')
end
tdcli.getChatHistory(msg.chat_id_, 0, 0, tonumber(rm), del_msg, nil)
else
tdcli.editMessageText(chat_id, msg.id_, nil, '*just [1-100]*', 1, 'md')
end
end
end
if input:match("^delall$") and is_sudo(msg) and msg.reply_to_message_id_ then
function tlg_del_all(extra, result, success)
tdcli.editMessageText(chat_id, msg.id_, nil, '#Done\n*All Msgs from * `'..result.sender_user_id_..'` *Has been deleted!*', 1, 'md')
tdcli.deleteMessagesFromUser(result.chat_id_, result.sender_user_id_)
end
tdcli.getMessage(msg.chat_id_, msg.reply_to_message_id_,tlg_del_all)
end
if input:match("^delall (%d+)$") and is_sudo(msg) then
local tlg = {string.match(txt, "^(delall) (%d+)$")}
tdcli.deleteMessagesFromUser(msg.chat_id_, tlg[2])
tdcli.editMessageText(chat_id, msg.id_, nil, '#Done\n>b>All Msg From user>/b> >code>'..tlg[2]..'>/code> >b>Deleted!>/b>', 1, 'html')
end
if input:match("^delall @(.*)$") and is_sudo(msg) then
local tlg = {string.match(txt, "^(delall) @(.*)$")}
function tlg_del_user(extra, result, success)
if result.id_ then
tdcli.deleteMessagesFromUser(msg.chat_id_, result.id_)
text = '<b>#Done\nAll Msg From user</b> <code>'..result.id_..'</code> <b>Deleted</b>'
else
text = '>b>User Not found!>/b>'
end
tdcli.editMessageText(chat_id, msg.id_, nil, text, 1, 'html')
end
tdcli.searchPublicChat(tlg[2],tlg_del_user)
end
if input:match("^stats$") and is_sudo(msg) then
local gps = redis:scard("gps:")
local users = redis:scard("pv:")
local allmgs = redis:get("allmsg:")
local sgps = redis:scard("sgpss:")
tdcli.editMessageText(chat_id, msg.id_, nil, '*> Self Bot Stats* :\n\n*> SuperGroups* : `'..sgps..'`\n*> Groups* : `'..gps..'`\n\n*> Users* : `'..users..'`\n*> SelfBot All Msg* : `'..allmgs..'`', 1, 'md')
end
if input:match("^pin$") and is_sudo(msg) then
local id = msg.id_
local msgs = {[0] = id}