forked from NeroTeam/creed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.lua
More file actions
1210 lines (1111 loc) Β· 49.2 KB
/
bot.lua
File metadata and controls
1210 lines (1111 loc) Β· 49.2 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
package.path = package.path .. ';.luarocks/share/lua/5.2/?.lua'
.. ';.luarocks/share/lua/5.2/?/init.lua'
package.cpath = package.cpath .. ';.luarocks/lib/lua/5.2/?.so'
-- @MuteTeam
http = require("socket.http")
https = require("ssl.https")
http.TIMEOUT = 10
JSON = require('dkjson')
-------@MuteTeam
tdcli = dofile('tdcli.lua')
redis = (loadfile "./libs/redis.lua")()
serpent = require('serpent')
serp = require 'serpent'.block
sudo_users = {
238773538,
173606679,
0
}
function string:split(sep)
local sep, fields = sep or ":", {}
local pattern = string.format("([^%s]+)", sep)
self:gsub(pattern, function(c)
fields[#fields + 1] = c
end)
return fields
end
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 is_normal(msg)
local chat_id = msg.chat_id_
local user_id = msg.sender_user_id_
local mutel = redis:sismember('muteusers:'..chat_id,user_id)
if mutel then
return true
end
if not mutel then
return false
end
end
-- function owner
function is_owner(msg)
local var = false
local chat_id = msg.chat_id_
local user_id = msg.sender_user_id_
local group_mods = redis:get('owners:'..chat_id)
if group_mods == tostring(user_id) then
var = true
end
for v, user in pairs(sudo_users) do
if user == user_id then
var = true
end
end
return var
end
--- function promote
function is_mod(msg)
local var = false
local chat_id = msg.chat_id_
local user_id = msg.sender_user_id_
if redis:sismember('mods:'..chat_id,user_id) then
var = true
end
if redis:get('owners:'..chat_id) == tostring(user_id) then
var = true
end
for v, user in pairs(sudo_users) do
if user == user_id then
var = true
end
end
return var
end
-- Print message format. Use serpent for prettier result.
function vardump(value, depth, key)
local linePrefix = ''
local spaces = ''
if key ~= nil then
linePrefix = key .. ' = '
end
if depth == nil then
depth = 0
else
depth = depth + 1
for i=1, depth do
spaces = spaces .. ' '
end
end
if type(value) == 'table' then
mTable = getmetatable(value)
if mTable == nil then
print(spaces .. linePrefix .. '(table) ')
else
print(spaces .. '(metatable) ')
value = mTable
end
for tableKey, tableValue in pairs(value) do
vardump(tableValue, depth, tableKey)
end
elseif type(value) == 'function' or
type(value) == 'thread' or
type(value) == 'userdata' or
value == nil then --@MuteTeam
print(spaces .. tostring(value))
elseif type(value) == 'string' then
print(spaces .. linePrefix .. '"' .. tostring(value) .. '",')
else
print(spaces .. linePrefix .. tostring(value) .. ',')
end
end
-- Print callback
function dl_cb(arg, data)
end
local function setowner_reply(extra, result, success)
t = vardump(result)
local msg_id = result.id_
local user = result.sender_user_id_
local ch = result.chat_id_
redis:del('owners:'..ch)
redis:set('owners:'..ch,user)
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, 'π #Done\nuser '..user..' *ownered*', 1, 'md')
print(user)
end
local function deowner_reply(extra, result, success)
t = vardump(result)
local msg_id = result.id_
local user = result.sender_user_id_
local ch = result.chat_id_
redis:del('owners:'..ch)
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, 'π #Done\nuser '..user..' *rem ownered*', 1, 'md')
print(user)
end
local database = 'http://vip.opload.ir/vipdl/94/11/amirhmz/'
local function setmod_reply(extra, result, success)
vardump(result)
local msg = result.id_
local user = result.sender_user_id_
local chat = result.chat_id_
redis:sadd('mods:'..chat,user)
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, ' π #Done\nuser '..user..' *Promoted*', 1, 'md')
end
local function remmod_reply(extra, result, success)
vardump(result)
local msg = result.id_
local user = result.sender_user_id_
local chat = result.chat_id_
redis:srem('mods:'..chat,user)
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, ' π #Done\nuser '..user..' *Rem Promoted*', 1, 'md')
end
function kick_reply(extra, result, success)
b = vardump(result)
tdcli.changeChatMemberStatus(result.chat_id_, result.sender_user_id_, 'Kicked')
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, '#Done\nπΉuser '..result.sender_user_id_..' *kicked*', 1, 'md')
end
function ban_reply(extra, result, success)
b = vardump(result)
tdcli.changeChatMemberStatus(result.chat_id_, result.sender_user_id_, 'Banned')
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, '#Done\nπΉuser '..result.sender_user_id_..' *banned*', 1, 'md')
end
local function setmute_reply(extra, result, success)
vardump(result)
redis:sadd('muteusers:'..result.chat_id_,result.sender_user_id_)
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, 'user '..result.sender_user_id_..' added to mutelist', 1, 'md')
end
local function demute_reply(extra, result, success)
vardump(result)
redis:srem('muteusers:'..result.chat_id_,result.sender_user_id_)
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, 'user '..result.sender_user_id_..' removed to mutelist', 1, 'md')
end
function tdcli_update_callback(data)
vardump(data)
if (data.ID == "UpdateNewMessage") then
local msg = data.message_
local input = msg.content_.text_
local chat_id = msg.chat_id_
local user_id = msg.sender_user_id_
local reply_id = msg.reply_to_message_id_
vardump(msg)
if msg.content_.ID == "MessageText" then
if input == "ping" then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '`pong`', 1, 'md')
end
if input == "PING" then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<b>PONG</b>', 1, 'html')
end
if input:match("^[#!/][Ii][Dd]$") then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<b>SuperGroup ID : </b><code>'..string.sub(chat_id, 5,14)..'</code>\n<b>User ID : </b><code>'..user_id..'</code>\n<b>Channel : </b>@MuteTeam', 1, 'html')
end
if input:match("^[#!/][Pp][Ii][Nn]$") and reply_id and is_owner(msg) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<b>Message Pinned</b>', 1, 'html')
tdcli.pinChannelMessage(chat_id, reply_id, 1)
end
if input:match("^[#!/][Uu][Nn][Pp][Ii][Nn]$") and reply_id and is_owner(msg) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<b>Message UnPinned</b>', 1, 'html')
tdcli.unpinChannelMessage(chat_id, reply_id, 1)
end
-----------------------------------------------------------------------------------------------------------------------------
if input:match('^[!#/]([Ss]etowner)$') and is_owner(msg) and msg.reply_to_message_id_ then
tdcli.getMessage(chat_id,msg.reply_to_message_id_,setowner_reply,nil)
end
if input == "/delowner" and is_sudo(msg) and msg.reply_to_message_id_ then
tdcli.getMessage(chat_id,msg.reply_to_message_id_,deowner_reply,nil)
end
if input:match('^[!#/]([Oo]wner)$') then
local hash = 'owners:'..chat_id
local owner = redis:get(hash)
if owner == nil then
tdcli.sendText(chat_id, 0, 0, 1, nil, 'πΈGroup *Not* Owner ', 1, 'md')
end
local owner_list = redis:get('owners:'..chat_id)
text85 = 'π€*Group Owner :*\n\n '..owner_list
tdcli.sendText(chat_id, 0, 0, 1, nil, text85, 1, 'md')
end
if input:match('^[/!#]setowner (.*)') and not input:find('@') and is_sudo(msg) then
redis:del('owners:'..chat_id)
redis:set('owners:'..chat_id,input:match('^[/!#]setowner (.*)'))
tdcli.sendText(chat_id, 0, 0, 1, nil, 'user '..input:match('^[/!#]setowner (.*)')..' ownered', 1, 'md')
end
if input:match('^[/!#]setowner (.*)') and input:find('@') and is_owner(msg) then
function Inline_Callback_(arg, data)
redis:del('owners:'..chat_id)
redis:set('owners:'..chat_id,input:match('^[/!#]setowner (.*)'))
tdcli.sendText(chat_id, 0, 0, 1, nil, 'user '..input:match('^[/!#]setowner (.*)')..' ownered', 1, 'md')
end
tdcli_function ({ID = "SearchPublicChat",username_ =input:match('^[/!#]setowner (.*)')}, Inline_Callback_, nil)
end
if input:match('^[/!#]delowner (.*)') and is_sudo(msg) then
redis:del('owners:'..chat_id)
tdcli.sendText(chat_id, 0, 0, 1, nil, 'user '..input:match('^[/!#]delowner (.*)')..' rem ownered', 1, 'md')
end
-----------------------------------------------------------------------------------------------------------------------
if input:match('^[/!#]promote') and is_sudo(msg) and msg.reply_to_message_id_ then
tdcli.getMessage(chat_id,msg.reply_to_message_id_,setmod_reply,nil)
end
if input:match('^[/!#]demote') and is_sudo(msg) and msg.reply_to_message_id_ then
tdcli.getMessage(chat_id,msg.reply_to_message_id_,remmod_reply,nil)
end
sm = input:match('^[/!#]promote (.*)')
if sm and is_sudo(msg) then
redis:sadd('mods:'..chat_id,sm)
tdcli.sendText(chat_id, 0, 0, 1, nil, 'π #Done\nuser '..sm..'*Add Promote*', 1, 'md')
end
dm = input:match('^[/!#]demote (.*)')
if dm and is_sudo(msg) then
redis:srem('mods:'..chat_id,dm)
tdcli.sendText(chat_id, 0, 0, 1, nil, 'π #Done\nuser '..dm..'*Rem Promote*', 1, 'md')
end
if input:match('^[/!#]modlist') then
if redis:scard('mods:'..chat_id) == 0 then
tdcli.sendText(chat_id, 0, 0, 1, nil, 'Group Not Mod', 1, 'md')
end
local text = "Group Mod List : \n"
for k,v in pairs(redis:smembers('mods:'..chat_id)) do
text = text.."_"..k.."_ - *"..v.."*\n"
end
tdcli.sendText(chat_id, 0, 0, 1, nil, text, 1, 'md')
end
--------------------------------------------------------
if input:match('^[/!#]setlink (.*)') and is_owner(msg) then
redis:set('link'..chat_id,input:match('^[/!#]setlink (.*)'))
tdcli.sendText(chat_id, 0, 0, 1, nil, 'Group Link Saved', 1, 'html')
end
if input:match('^[/!#]link') and is_owner(msg) then
link = redis:get('link'..chat_id)
tdcli.sendText(chat_id, 0, 0, 1, nil, 'Group Link :\n'..link, 1, 'html')
end
-------------------------------------------------------
if input:match('^[/!#]setrules (.*)') and is_owner(msg) then
redis:set('gprules'..chat_id,input:match('^[/!#]setrules (.*)'))
tdcli.sendText(chat_id, 0, 0, 1, nil, 'Group Rules Saved', 1, 'html')
end
if input:match('^[/!#]rules') then
rules = redis:get('gprules'..chat_id)
tdcli.sendText(chat_id, 0, 0, 1, nil, 'Group Rules :\n'..rules, 1, 'html')
end
--------------------------------------------------------------------------
local res = http.request(database.."joke.db")
local joke = res:split(",")
if input:match'[!/#](joke)' then
local run = joke[math.random(#joke)]
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, run..'\n\n*By MuteTeam*', 1, 'md')
end
---------------------------------------------------------------------------------------------------------------------------------
if input:match("^[#!/][Aa]dd$") and is_sudo(msg) then
redis:sadd('groups',chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Group Has Been Added By* `'..msg.sender_user_id_..'`', 1, 'md')
end
-------------------------------------------------------------------------------------------------------------------------------------------
if input:match("^[#!/][Rr]em$") and is_sudo(msg) then
redis:srem('groups',chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Group Has Been Removed By* `'..msg.sender_user_id_..'`', 1, 'md')
end
-----------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------
if input:match('^[!#/](kick)$') and is_mod(msg) then
tdcli.getMessage(chat_id,reply,kick_reply,nil)
end
if input:match('^[!#/]kick (.*)') and not input:find('@') and is_mod(msg) then
tdcli.sendText(chat_id, 0, 0, 1, nil, 'user '..input:match('^[!#/]kick (.*)')..' kicked', 1, 'md')
tdcli.changeChatMemberStatus(chat_id, input:match('^[!#/]kick (.*)'), 'Kicked')
end
if input:match('^[!#/]kick (.*)') and input:find('@') and is_mod(msg) then
function Inline_Callback_(arg, data)
tdcli.sendText(chat_id, 0, 0, 1, nil, 'user '..input:match('^[!#/]kick (.*)')..' kicked', 1, 'md')
tdcli.changeChatMemberStatus(chat_id, data.id_, 'Kicked')
end
tdcli_function ({ID = "SearchPublicChat",username_ =input:match('^[!#/]kick (.*)')}, Inline_Callback_, nil)
end
--------------------------------------------------------
----------------------------------------------------------
if input:match('^[/!#]muteuser') and is_mod(msg) and msg.reply_to_message_id_ then
redis:set('tbt:'..chat_id,'yes')
tdcli.getMessage(chat_id,msg.reply_to_message_id_,setmute_reply,nil)
end
if input:match('^[/!#]unmuteuser') and is_mod(msg) and msg.reply_to_message_id_ then
tdcli.getMessage(chat_id,msg.reply_to_message_id_,demute_reply,nil)
end
mu = input:match('^[/!#]muteuser (.*)')
if mu and is_mod(msg) then
redis:sadd('muteusers:'..chat_id,mu)
redis:set('tbt:'..chat_id,'yes')
tdcli.sendText(chat_id, 0, 0, 1, nil, 'user '..mu..' added to mutelist', 1, 'md')
end
umu = input:match('^[/!#]unmuteuser (.*)')
if umu and is_mod(msg) then
redis:srem('muteusers:'..chat_id,umu)
tdcli.sendText(chat_id, 0, 0, 1, nil, 'user '..umu..' removed to mutelist', 1, 'md')
end
if input:match('^[/!#]muteusers') then
if redis:scard('muteusers:'..chat_id) == 0 then
tdcli.sendText(chat_id, 0, 0, 1, nil, 'Group Not MuteUser', 1, 'md')
end
local text = "MuteUser List:\n"
for k,v in pairs(redis:smembers('muteusers:'..chat_id)) do
text = text.."<b>"..k.."</b> - <b>"..v.."</b>\n"
end
tdcli.sendText(chat_id, 0, 0, 1, nil, text, 1, 'html')
end
-------------------------------------------------------
--lock links
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock links$") and is_mod(msg) and groups then
if redis:get('lock_linkstg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π«_ Links is already Locked_', 1, 'md')
else
redis:set('lock_linkstg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Links Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock links$") and is_mod(msg) and groups then
if not redis:get('lock_linkstg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« links is already UnLocked', 1, 'md')
else
redis:del('lock_linkstg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nlinks Has Been UnLocked', 1, 'md')
end
end
--lock username
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock username$") and is_mod(msg) and groups then
if redis:get('usernametg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Username is already Locked', 1, 'md')
else
redis:set('usernametg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nUsername Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock username$") and is_mod(msg) and groups then
if not redis:get('usernametg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Username is already UnLocked', 1, 'md')
else
redis:del('usernametg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nUsername Has Been UnLocked', 1, 'md')
end
end
--lock tag
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock tag$") and is_mod(msg) and groups then
if redis:get('tagtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Tag is already Locked', 1, 'md')
else
redis:set('tagtg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nTag Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock tag$") and is_mod(msg) and groups then
if not redis:get('tagtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Tag is already Not Locked', 1, 'md')
else
redis:del('tagtg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\n.... Has Been UnLocked', 1, 'md')
end
end
--lock forward
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock forward$") and is_mod(msg) and groups then
if redis:get('forwardtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Forward is already Locked', 1, 'md')
else
redis:set('forwardtg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nForward Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock forward$") and is_mod(msg) and groups then
if not redis:get('forwardtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Forward is already Not Locked', 1, 'md')
else
redis:del('forwardtg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nForward Has Been UnLocked', 1, 'md')
end
end
--arabic/persian
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock arabic$") and is_mod(msg) and groups then
if redis:get('arabictg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Persian/Arabic is already Locked', 1, 'md')
else
redis:set('arabictg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nPersian/Arabic Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock arabic$") and is_mod(msg) and groups then
if not redis:get('arabictg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Persian/Arabic is already Not Locked', 1, 'md')
else
redis:del('arabictg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nPersian/Arabic Has Been UnLocked', 1, 'md')
end
end
---english
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock english$") and is_mod(msg) and groups then
if redis:get('engtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« English is already Locked', 1, 'md')
else
redis:set('engtg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nEnglish Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock english$") and is_mod(msg) and groups then
if not redis:get('engtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« English is already Not Locked', 1, 'md')
else
redis:del('engtg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nEnglish Has Been UnLocked', 1, 'md')
end
end
--lock foshtg
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock fosh$") and is_mod(msg) and groups then
if redis:get('badwordtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Fosh is already Locked', 1, 'md')
else
redis:set('badwordtg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nFosh Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock fosh$") and is_mod(msg) and groups then
if not redis:get('badwordtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Fosh is already Not Locked', 1, 'md')
else
redis:del('badwordtg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nFosh Has Been UnLocked', 1, 'md')
end
end
--lock edit
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock edit$") and is_mod(msg) and groups then
if redis:get('edittg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Edit is already Locked', 1, 'md')
else
redis:set('edittg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nEdit Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock edit$") and is_mod(msg) and groups then
if not redis:get('edittg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Edit is already Not Locked', 1, 'md')
else
redis:del('edittg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nEdit Has Been UnLocked', 1, 'md')
end
end
--- lock Caption
if input:match("^[#!/]lock caption$") and is_mod(msg) and groups then
if redis:get('captg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Caption is already Locked', 1, 'md')
else
redis:set('captg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nCaption Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock caption$") and is_mod(msg) and groups then
if not redis:get('captg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Caption is already Not Locked', 1, 'md')
else
redis:del('captg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nCaption Has Been UnLocked', 1, 'md')
end
end
--lock emoji
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock emoji") and is_mod(msg) and groups then
if redis:get('emojitg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Emoji is already Locked', 1, 'md')
else
redis:set('emojitg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nEmoji Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock emoji$") and is_mod(msg) and groups then
if not redis:get('emojitg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Emoji is already Not Locked', 1, 'md')
else
redis:del('emojitg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nEmoji Has Been UNLocked', 1, 'md')
end
end
--- lock inline
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock inline") and is_mod(msg) and groups then
if redis:get('inlinetg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Inline is already Locked', 1, 'md')
else
redis:set('inlinetg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nInline Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock inline$") and is_mod(msg) and groups then
if not redis:get('inlinetg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Inline is already Not Locked', 1, 'md')
else
redis:del('inlinetg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nInline Has Been UNLocked', 1, 'md')
end
end
-- lock reply
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock reply") and is_mod(msg) and groups then
if redis:get('replytg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Reply is already Locked', 1, 'md')
else
redis:set('replytg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nReply Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock reply$") and is_mod(msg) and groups then
if not redis:get('replytg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Reply is already Not Locked', 1, 'md')
else
redis:del('replytg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nReply Has Been UNLocked', 1, 'md')
end
end
--lock tgservice
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/][Ll]ock tgservice$") and is_mod(msg) and groups then
if redis:get('tgservice:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« TGservice is already Locked', 1, 'md')
else
redis:set('tgservice:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nTGservice Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/][Uu]nlock tgservice$") and is_mod(msg) and groups then
if not redis:get('tgservice:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« TGservice is already Not Locked', 1, 'md')
else
redis:del('tgservice:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nTGservice Has Been UnLocked', 1, 'md')
end
end
--lock flood (by @Flooding)
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/]lock flood") and is_mod(msg) and groups then
if redis:get('floodtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« Flood is already Locked', 1, 'md')
else
redis:set('floodtg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Done\nFlood Has Been Locked', 1, 'md')
end
end
if input:match("^[#!/]unlock flood$") and is_mod(msg) and groups then
if not redis:get('floodtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'π« flood is already Not Locked', 1, 'md')
else
redis:del('flood:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, 'β
#Flood\nReply Has Been UNLocked', 1, 'md')
end
end
--------------------------------
---------------------------------------------------------------------------------
local link = 'lock_linkstg:'..chat_id
if redis:get(link) then
link = "`Enable`"
else
link = "`Disable`"
end
local username = 'usernametg:'..chat_id
if redis:get(username) then
username = "`Enable`"
else
username = "`Disable`"
end
local tag = 'tagtg:'..chat_id
if redis:get(tag) then
tag = "`Enable`"
else
tag = "`Disable`"
end
local flood = 'flood:'..chat_id
if redis:get(flood) then
flood = "`Enable`"
else
flood = "`Disable`"
end
local forward = 'forwardtg:'..chat_id
if redis:get(forward) then
forward = "`Enable`"
else
forward = "`Disable`"
end
local arabic = 'arabictg:'..chat_id
if redis:get(arabic) then
arabic = "`Enable`"
else
arabic = "`Disable`"
end
local eng = 'engtg:'..chat_id
if redis:get(eng) then
eng = "`Enable`"
else
eng = "`Disable`"
end
local badword = 'badwordtg:'..chat_id
if redis:get(badword) then
badword = "`Enable`"
else
badword = "`Disable`"
end
local edit = 'edittg:'..chat_id
if redis:get(edit) then
edit = "`Enable`"
else
edit = "`Disable`"
end
local emoji = 'emojitg:'..chat_id
if redis:get(emoji) then
emoji = "`Enable`"
else
emoji = "`Disable`"
end
local caption = 'captg:'..chat_id
if redis:get(caption) then
caption = "`Enable`"
else
caption = "`Disable`"
end
local inline = 'inlinetg:'..chat_id
if redis:get(inline) then
inline = "`Enable`"
else
inline = "`Disable`"
end
local reply = 'replytg:'..chat_id
if redis:get(reply) then
reply = "`Enable`"
else
reply = "`Disable`"
end
----------------------------
--muteall
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/][Mm]ute all$") and is_mod(msg) and groups then
if redis:get('mute_alltg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute All is already on*', 1, 'md')
else
redis:set('mute_alltg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute All has been enabled*', 1, 'md')
end
end
if input:match("^[#!/][Uu]nmute all$") and is_mod(msg) and groups then
if not redis:get('mute_alltg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute All is already disabled*', 1, 'md')
else
redis:del('mute_alltg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute All has been disabled*', 1, 'md')
end
end
--mute sticker
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/][Mm]ute sticker$") and is_mod(msg) and groups then
if redis:get('mute_stickertg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute sticker is already on*', 1, 'md')
else
redis:set('mute_stickertg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute sticker has been enabled*', 1, 'md')
end
end
if input:match("^[#!/][Uu]nmute sticker$") and is_mod(msg) and groups then
if not redis:get('mute_stickertg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute sticker is already disabled*', 1, 'md')
else
redis:del('mute_stickertg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute sticker has been disabled*', 1, 'md')
end
end
--mute gift
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/][Mm]ute gift$") and is_mod(msg) and groups then
if redis:get('mute_gifttg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute gift is already on*', 1, 'md')
else
redis:set('mute_gifttg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute gift has been enabled*', 1, 'md')
end
end
if input:match("^[#!/][Uu]nmute gift$") and is_mod(msg) and groups then
if not redis:get('mute_gifttg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute gift is already disabled*', 1, 'md')
else
redis:del('mute_gifttg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute gift has been disabled*', 1, 'md')
end
end
--mute contact
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/][Mm]ute contact$") and is_mod(msg) and groups then
if redis:get('mute_contacttg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute contact is already on*', 1, 'md')
else
redis:set('mute_contacttg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute contact has been enabled*', 1, 'md')
end
end
if input:match("^[#!/][Uu]nmute contact$") and is_mod(msg) and groups then
if not redis:get('mute_contacttg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute contact is already disabled*', 1, 'md')
else
redis:del('mute_contacttg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute contact has been disabled*', 1, 'md')
end
end
--mute photo
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/][Mm]ute photo$") and is_mod(msg) and groups then
if redis:get('mute_phototg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute photo is already on*', 1, 'md')
else
redis:set('mute_phototg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute photo has been enabled*', 1, 'md')
end
end
if input:match("^[#!/][Uu]nmute photo$") and is_mod(msg) and groups then
if not redis:get('mute_phototg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute photo is already disabled*', 1, 'md')
else
redis:del('mute_phototg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute photo has been disabled*', 1, 'md')
end
end
--mute audio
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/][Mm]ute audio$") and is_mod(msg) and groups then
if redis:get('mute_audiotg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute audio is already on*', 1, 'md')
else
redis:set('mute_audiotg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute audio has been enabled*', 1, 'md')
end
end
if input:match("^[#!/][Uu]nmute audio$") and is_mod(msg) and groups then
if not redis:get('mute_audiotg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute audio is already disabled*', 1, 'md')
else
redis:del('mute_audiotg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute audio has been disabled*', 1, 'md')
end
end
--mute voice
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/][Mm]ute voice$") and is_mod(msg) and groups then
if redis:get('mute_voicetg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute voice is already on*', 1, 'md')
else
redis:set('mute_voicetg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute voice has been enabled*', 1, 'md')
end
end
if input:match("^[#!/][Uu]nmute voice$") and is_mod(msg) and groups then
if not redis:get('mute_voicetg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute voice is already disabled*', 1, 'md')
else
redis:del('mute_voicetg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute voice has been disabled*', 1, 'md')
end
end
--mute video
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/][Mm]ute video$") and is_mod(msg) and groups then
if redis:get('mute_videotg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute video is already on*', 1, 'md')
else
redis:set('mute_videotg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute video has been enabled*', 1, 'md')
end
end
if input:match("^[#!/][Uu]nmute video$") and is_mod(msg) and groups then
if not redis:get('mute_videotg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute video is already disabled*', 1, 'md')
else
redis:del('mute_videotg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute video has been disabled*', 1, 'md')
end
end
--mute document
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/][Mm]ute document$") and is_mod(msg) and groups then
if redis:get('mute_documenttg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute document is already on*', 1, 'md')
else
redis:set('mute_documenttg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute document has been enabled*', 1, 'md')
end
end
if input:match("^[#!/][Uu]nmute document$") and is_mod(msg) and groups then
if not redis:get('mute_documenttg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute document is already disabled*', 1, 'md')
else
redis:del('mute_documenttg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute document has been disabled*', 1, 'md')
end
end
--mute text
groups = redis:sismember('groups',chat_id)
if input:match("^[#!/][Mm]ute text$") and is_mod(msg) and groups then
if redis:get('mute_texttg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute text is already on*', 1, 'md')
else
redis:set('mute_texttg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute text has been enabled*', 1, 'md')
end
end
if input:match("^[#!/][Uu]nmute text$") and is_mod(msg) and groups then
if not redis:get('mute_texttg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute text is already disabled*', 1, 'md')
else
redis:del('mute_texttg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Mute text has been disabled*', 1, 'md')
end
end
--settings
local all = 'mute_alltg:'..chat_id
if redis:get(all) then
All = "`Mute`"
else
All = "`UnMute`"
end
local sticker = 'mute_stickertg:'..chat_id
if redis:get(sticker) then
sticker = "`Mute`"
else
sticker = "`UnMute`"
end
local gift = 'mute_gifttg:'..chat_id
if redis:get(gift) then
gift = "`Mute`"
else
gift = "`UnMute`"
end
local contact = 'mute_contacttg:'..chat_id
if redis:get(contact) then
contact = "`Mute`"
else
contact = "`UnMute`"
end
local photo = 'mute_phototg:'..chat_id
if redis:get(photo) then
photo = "`Mute`"
else
photo = "`UnMute`"
end
local audio = 'mute_audiotg:'..chat_id
if redis:get(audio) then
audio = "`Mute`"
else
audio = "`UnMute`"
end
local voice = 'mute_voicetg:'..chat_id
if redis:get(voice) then
voice = "`Mute`"
else
voice = "`UnMute`"
end
local video = 'mute_videotg:'..chat_id
if redis:get(video) then
video = "`Mute`"
else
video = "`UnMute`"
end
local document = 'mute_documenttg:'..chat_id
if redis:get(document) then
document = "`Mute`"
else
document = "`UnMute`"
end
local text1 = 'mute_texttg:'..chat_id
if redis:get(text1) then
text1 = "`Mute`"
else
text1 = "`UnMute`"
end
if input:match("^[#!/][Ss]ettings$") and is_mod(msg) then
local text = "π₯ SuperGroup Settings :".."\n"
.."*Lock Flood => *".."`"..flood.."`".."\n"
.."*Lock Link => *".."`"..link.."`".."\n"
.."*Lock Tag => *".."`"..tag.."`".."\n"
.."*Lock Username => *".."`"..username.."`".."\n"
.."*Lock Forward => *".."`"..forward.."`".."\n"
.."*Lock Arabic/Persian => *".."`"..arabic..'`'..'\n'
.."*Lock English => *".."`"..eng..'`'..'\n'
.."*Lock Reply => *".."`"..reply..'`'..'\n'
.."*Lock Fosh => *".."`"..badword..'`'..'\n'
.."*Lock Edit => *".."`"..edit..'`'..'\n'
.."*Lock Caption => *".."`"..caption..'`'..'\n'
.."*Lock Inline => *".."`"..inline..'`'..'\n'
.."*Lock Emoji => *".."`"..emoji..'`'..'\n'
.."*ββββββββββββββββββββββ*".."\n"
.."π£ Mute List :".."\n"
.."*Mute All : *".."`"..All.."`".."\n"