-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbot.lua
1180 lines (1083 loc) · 46.9 KB
/
bot.lua
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'
---- @AnonySecurity
http = require("socket.http")
https = require("ssl.https")
http.TIMEOUT = 10
JSON = require('dkjson')
--------- @AnonySecurity
tdcli = dofile('tdcli.lua')
redis = (loadfile "./libs/redis.lua")()
serpent = require('serpent')
serp = require 'serpent'.block
sudo_users = {
133362226,
324656723,
}
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 --@AnOnySeCuRiTy
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, '` کاربر ` '..user..' ` اونرشد `', 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, '` کاربر ` '..user..'` از اونری حذف شد `', 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, '` کاربر `'..user..'` معاون شد `', 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, '` کاربر `'..user..'` معاون حذف شد `', 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, '` کاربر `'..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, '` کاربر `'..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, '` کاربر `'..result.sender_user_id_..' ` رفت تو سایلنت `', 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, '` کاربر `'..result.sender_user_id_..' ` حذف شد از سایلنت `', 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 == "on" then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '`on`', 1, 'md')
end
if input == "تست" then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<b>روشنم</b>', 1, 'html')
end
if input:match("^id$") then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<code>شناسه گروه: </code><code>'..string.sub(chat_id, 5,14)..'</code>\n<code>شناسه کابری: </code><code>'..user_id..'</code>\n<code>کانال: </code>@AnOnySeCuRiTy', 1, 'html')
end
if input:match("^pin$") and reply_id and is_owner(msg) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<b>پیام پین شد</b>', 1, 'html')
tdcli.pinChannelMessage(chat_id, reply_id, 1)
end
if input:match("^unpin$") and reply_id and is_owner(msg) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<b>پیام از پین برداشته شد</b>', 1, 'html')
tdcli.unpinChannelMessage(chat_id, reply_id, 1)
end
-----------------------------------------------------------------------------------------------------------------------------
if input:match('^setowner$') 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('^owner$') then
local hash = 'owners:'..chat_id
local owner = redis:get(hash)
if owner == nil then
tdcli.sendText(chat_id, 0, 0, 1, nil, '`گروه اونر ندارد ` ', 1, 'md')
end
local owner_list = redis:get('owners:'..chat_id)
text85 = '👤`اونرگروه :`\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, '` کاربر `'..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, '` کاربر `'..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, '` کاربر `'..input:match('^delowner (.*)')..' ` مدیر حذف شد `', 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, '`کاربر \n`'..sm..'` معاون شد: `', 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, '`کاربر\n `'..dm..'` از معاونی برکنار شد: `', 1, 'md')
end
if input:match('^modlist') then
if redis:scard('mods:'..chat_id) == 0 then
tdcli.sendText(chat_id, 0, 0, 1, nil, '`مدیری نیست عخی`', 1, 'md')
end
local text = "`مدیران ربات درگروه:` \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, '`لینک ذخیره شد`', 1, 'md')
end
if input:match('^[/!#]link') and is_owner(msg) then
link = redis:get('link'..chat_id)
tdcli.sendText(chat_id, 0, 0, 1, nil, '`لینک گروه:`\n'..link, 1, 'md')
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, '`قوانین ذخیره شد`', 1, 'md')
end
if input:match('^rules') then
rules = redis:get('gprules'..chat_id)
tdcli.sendText(chat_id, 0, 0, 1, nil, '`قوانین :`\n'..rules, 1, 'md')
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* @Sc0rpion', 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, '` ربات اد شد توسط `'..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, '` ربات غیر فعال شد توسط `'..msg.sender_user_id_..'', 1, 'md')
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, '` کاربر `'..mu..' ` رفت تو سایلنت `', 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, '` کاربر `'..umu..' `حذف از سایلنت`', 1, 'md')
end
if input:match('^muteusers') then
if redis:scard('muteusers:'..chat_id) == 0 then
tdcli.sendText(chat_id, 0, 0, 1, nil, '`گروه سایلنت ندارد`', 1, 'md')
end
local text = "`سایلنت لیست:`\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, '🔐 `ضدلینک قفل بوده`', 1, 'md')
else
redis:set('lock_linkstg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `ضدلینک قفل`', 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, '🔓 `ضدلینک باز بوده`', 1, 'md')
else
redis:del('lock_linkstg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `ضدلینک باز`', 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, '🔐 `یوزرنیم قفل بوده`', 1, 'md')
else
redis:set('usernametg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `یوزرنیم قفل`', 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, '🔓 `یوزرنیم باز بوده`', 1, 'md')
else
redis:del('usernametg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `یوزرنیم باز`', 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, '🔐 `تگ قفل بوده`', 1, 'md')
else
redis:set('tagtg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `تگ قفل`', 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, '🔓 `تگ باز بوده`', 1, 'md')
else
redis:del('tagtg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `تگ باز`', 1, 'md')
end
end
--lock forward
groups = redis:sismember('groups',chat_id)
if input:match("^lock fwd$") and is_mod(msg) and groups then
if redis:get('forwardtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `فوروارد قفل بوده`', 1, 'md')
else
redis:set('forwardtg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `فوروارد قفل`', 1, 'md')
end
end
if input:match("^unlock fwd$") and is_mod(msg) and groups then
if not redis:get('forwardtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `فوروارد باز بوده`', 1, 'md')
else
redis:del('forwardtg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `فوروارد باز`', 1, 'md')
end
end
--arabic/persian
groups = redis:sismember('groups',chat_id)
if input:match("^lock abc$") and is_mod(msg) and groups then
if redis:get('arabictg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `حروف فارسی قفل بوده`', 1, 'md')
else
redis:set('arabictg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `حروف فارسی قفل`', 1, 'md')
end
end
if input:match("^unlock abc$") and is_mod(msg) and groups then
if not redis:get('arabictg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `حروف فارسی باز بوده`', 1, 'md')
else
redis:del('arabictg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `حروف فارسی باز`', 1, 'md')
end
end
---english
groups = redis:sismember('groups',chat_id)
if input:match("^lock eng$") and is_mod(msg) and groups then
if redis:get('engtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `انگلیسی قفل بوده`', 1, 'md')
else
redis:set('engtg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `انگلیسی قفل`', 1, 'md')
end
end
if input:match("^unlock eng$") and is_mod(msg) and groups then
if not redis:get('engtg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `انگلیسی باز بوده`', 1, 'md')
else
redis:del('engtg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `انگلیسی باز`', 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, '🔐 `فش قفل بوده`', 1, 'md')
else
redis:set('badwordtg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `فش قفل`', 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, '🔓 `فش باز بوده`', 1, 'md')
else
redis:del('badwordtg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `فش باز`', 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, '🔐 `ادیت قفل بوده`', 1, 'md')
else
redis:set('edittg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `ادیت قفل`', 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, '🔓 `ادیت باز بوده`', 1, 'md')
else
redis:del('edittg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `ادیت باز`', 1, 'md')
end
end
--- lock Caption
if input:match("^lock cap$") and is_mod(msg) and groups then
if redis:get('captg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `کپشن قفل بوده`', 1, 'md')
else
redis:set('captg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `کپشن قفل`', 1, 'md')
end
end
if input:match("^unlock cap$") and is_mod(msg) and groups then
if not redis:get('captg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `کپشن بازبوده`', 1, 'md')
else
redis:del('captg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `کپشن باز`', 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, '🔐 `اموجی قفل بوده`', 1, 'md')
else
redis:set('emojitg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `اموجی قفل`', 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, '🔓 `اموجی باز بوده`', 1, 'md')
else
redis:del('emojitg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `اموجی باز`', 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, '🔐 `اینلابن قفل بوده`', 1, 'md')
else
redis:set('inlinetg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `اینلاین قفل`', 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, '🔓 `اینلابن باز بوده`', 1, 'md')
else
redis:del('inlinetg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `اینلاین باز`', 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, '🔐 `ریپلی قفل بوده`', 1, 'md')
else
redis:set('replytg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `ریپلی قفل`', 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, '🔓 `ریپلی باز بوده`', 1, 'md')
else
redis:del('replytg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `ریپلی باز`', 1, 'md')
end
end
--lock tgservice
groups = redis:sismember('groups',chat_id)
if input:match("^lock 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 قفل بوده`', 1, 'md')
else
redis:set('tgservice:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `TGservice قفل`', 1, 'md')
end
end
if input:match("^unlock 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 بازبوده`', 1, 'md')
else
redis:del('tgservice:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `TGservice بازشد`', 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, '🔐 `فلود قفل بوده`', 1, 'md')
else
redis:set('floodtg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔐 `فلود قفل`', 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, '🔓 `فلود باز بوده`', 1, 'md')
else
redis:del('flood:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔓 `فلود بازشد`', 1, 'md')
end
end
--------------------------------
---------------------------------------------------------------------------------
local link = 'lock_linkstg:'..chat_id
if redis:get(link) then
link = "🔐"
else
link = "🔓"
end
local username = 'usernametg:'..chat_id
if redis:get(username) then
username = "🔐"
else
username = "🔓"
end
local tag = 'tagtg:'..chat_id
if redis:get(tag) then
tag = "🔐"
else
tag = "🔓"
end
local flood = 'floodtg:'..chat_id
if redis:get(flood) then
flood = "🔐"
else
flood = "🔓"
end
local forward = 'forwardtg:'..chat_id
if redis:get(forward) then
forward = "🔐"
else
forward = "🔓"
end
local arabic = 'arabictg:'..chat_id
if redis:get(arabic) then
arabic = "🔐"
else
arabic = "🔓"
end
local eng = 'engtg:'..chat_id
if redis:get(eng) then
eng = "🔐"
else
eng = "🔓"
end
local badword = 'badwordtg:'..chat_id
if redis:get(badword) then
badword = "🔐"
else
badword = "🔓"
end
local edit = 'edittg:'..chat_id
if redis:get(edit) then
edit = "🔐"
else
edit = "🔓"
end
local emoji = 'emojitg:'..chat_id
if redis:get(emoji) then
emoji = "🔐"
else
emoji = "🔓"
end
local caption = 'captg:'..chat_id
if redis:get(caption) then
caption = "🔐"
else
caption = "🔓"
end
local inline = 'inlinetg:'..chat_id
if redis:get(inline) then
inline = "🔐"
else
inline = "🔓"
end
local reply = 'replytg:'..chat_id
if redis:get(reply) then
reply = "🔐"
else
reply = "🔓"
end
----------------------------
--muteall
groups = redis:sismember('groups',chat_id)
if input:match("^mute 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, '🔇`چت قفل بود`', 1, 'md')
else
redis:set('mute_alltg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔇`چت قفل شد`', 1, 'md')
end
end
if input:match("^unmute 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, '🔊`چت باز بود`', 1, 'md')
else
redis:del('mute_alltg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔊`چت باز شد`', 1, 'md')
end
end
--mute sticker
groups = redis:sismember('groups',chat_id)
if input:match("^mute 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, '🔇`استیکر قفل بوده`', 1, 'md')
else
redis:set('mute_stickertg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔇`استیکرقفل`', 1, 'md')
end
end
if input:match("^unmute 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, '🔊`استیکرباز بوده`', 1, 'md')
else
redis:del('mute_stickertg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔊`استیکر باز`', 1, 'md')
end
end
--mute gift
groups = redis:sismember('groups',chat_id)
if input:match("^mute gif$") and is_mod(msg) and groups then
if redis:get('mute_gifttg:'..chat_id) then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔇`گیف قفل بوده`', 1, 'md')
else
redis:set('mute_gifttg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔇`گیف قفل`', 1, 'md')
end
end
if input:match("^unmute gif$") 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, '🔊`گیف باز بوده`', 1, 'md')
else
redis:del('mute_gifttg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔊`گیف باز`', 1, 'md')
end
end
--mute contact
groups = redis:sismember('groups',chat_id)
if input:match("^mute 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, '🔇`شماره قفل بوده`', 1, 'md')
else
redis:set('mute_contacttg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔇`شماره قفل`', 1, 'md')
end
end
if input:match("^unmute 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, '🔊`شماره باز بوده`', 1, 'md')
else
redis:del('mute_contacttg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔊`شماره باز`', 1, 'md')
end
end
--mute photo
groups = redis:sismember('groups',chat_id)
if input:match("^mute 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, '🔇`عکس قفل بوده`', 1, 'md')
else
redis:set('mute_phototg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔇`عکس قفل`', 1, 'md')
end
end
if input:match("^unmute 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, '🔊`عکس باز بوده`', 1, 'md')
else
redis:del('mute_phototg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔊`عکس باز`', 1, 'md')
end
end
--mute audio
groups = redis:sismember('groups',chat_id)
if input:match("^mute 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, '🔇`موزیک قفل بوده`', 1, 'md')
else
redis:set('mute_audiotg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔇`موزیک قفل`', 1, 'md')
end
end
if input:match("^unmute 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, '🔊`موزیک باز بوده`', 1, 'md')
else
redis:del('mute_audiotg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔊`موزیک باز`', 1, 'md')
end
end
--mute voice
groups = redis:sismember('groups',chat_id)
if input:match("^mute 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, '🔇`ویس قفل بوده`', 1, 'md')
else
redis:set('mute_voicetg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔇`ویس قفل`', 1, 'md')
end
end
if input:match("^unmute 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, '🔊`ویس باز بوده`', 1, 'md')
else
redis:del('mute_voicetg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔊`ویس باز`', 1, 'md')
end
end
--mute video
groups = redis:sismember('groups',chat_id)
if input:match("^mute 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, '🔇`فیلم قفل بوده`', 1, 'md')
else
redis:set('mute_videotg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔇`فیلم قفل`', 1, 'md')
end
end
if input:match("^unmute 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, '🔊`فیلم باز بوده`', 1, 'md')
else
redis:del('mute_videotg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔊`فیلم باز`', 1, 'md')
end
end
--mute document
groups = redis:sismember('groups',chat_id)
if input:match("^mute 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, '🔇`داکیومنت قفل بوده`', 1, 'md')
else
redis:set('mute_documenttg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔇`داکیومنت قفل`', 1, 'md')
end
end
if input:match("^unmute 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, '🔊`داکیومنت باز بوده`', 1, 'md')
else
redis:del('mute_documenttg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔊`داکیومنت باز`', 1, 'md')
end
end
--mute text
groups = redis:sismember('groups',chat_id)
if input:match("^mute 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, '🔇`تکست قفل بوده`', 1, 'md')
else
redis:set('mute_texttg:'..chat_id, true)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔇`تکست قفل`', 1, 'md')
end
end
if input:match("^unmute 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, '🔊`تکست باز بوده `', 1, 'md')
else
redis:del('mute_texttg:'..chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '🔊`تکست باز `', 1, 'md')
end
end
--settings
local all = 'mute_alltg:'..chat_id
if redis:get(all) then
All = "🔇"
else
All = "🔊"
end
local sticker = 'mute_stickertg:'..chat_id
if redis:get(sticker) then
sticker = "🔇"
else
sticker = "🔊"
end
local gift = 'mute_gifttg:'..chat_id
if redis:get(gift) then
gift = "🔇"
else
gift = "🔊"
end
local contact = 'mute_contacttg:'..chat_id
if redis:get(contact) then
contact = "🔇"
else
contact = "🔊"
end
local photo = 'mute_phototg:'..chat_id
if redis:get(photo) then
photo = "🔇"
else
photo = "🔊"
end
local audio = 'mute_audiotg:'..chat_id
if redis:get(audio) then
audio = "🔇"
else
audio = "🔊"
end
local voice = 'mute_voicetg:'..chat_id
if redis:get(voice) then
voice = "🔇"
else
voice = "🔊"
end
local video = 'mute_videotg:'..chat_id
if redis:get(video) then
video = "🔇"
else
video = "🔊"
end
local document = 'mute_documenttg:'..chat_id
if redis:get(document) then
document = "🔇"
else
document = "🔊"
end
local text1 = 'mute_texttg:'..chat_id
if redis:get(text1) then
text1 = "🔇"
else
text1 = "🔊"
end
if input:match("^settings$") and is_mod(msg) then
local text = "⚙*Settings*⚙".."\n"
.."\n".."🔰`Flood: `".."*"..flood.."*".."\n"
.."🔰`Link: `".."*"..link.."*".."\n"
.."🔰`Tag: `".."*"..tag.."*".."\n"
.."🔰`Username: `".."*"..username.."*".."\n"
.."🔰`Forward: `".."*"..forward.."*".."\n"
.."🔰`Persian: `".."*"..arabic..'*'..'\n'
.."🔰`English: `".."*"..eng..'*'..'\n'
.."🔰`reply: `".."*"..reply..'*'..'\n'
.."🔰`Fosh: `".."*"..badword..'*'..'\n'
.."🔰`Edit: `".."*"..edit..'*'..'\n'
.."🔰`Caption: `".."*"..caption..'*'..'\n'
.."🔰`Inline: `".."*"..inline..'*'..'\n'
.."🔰`Emoji: `".."*"..emoji..'*'..'\n'
.."🔰`Chat: `".."*"..All.."*".."\n"
.."🔰`Sticker: `".."*"..sticker.."*".."\n"
.."🔰`Gif: `".."*"..gift.."*".."\n"
.."🔰`Contact: `".."*"..contact.."*".."\n"
.."🔰`Photo: `".."*"..photo.."*".."\n"
.."🔰`Audio: `".."*"..audio.."*".."\n"
.."🔰`Voice: `".."*"..voice.."*".."\n"
.."🔰`Video: `".."*"..video.."*".."\n"
.."🔰`Document: `".."*"..document.."*".."\n"
.."🔰`Text: `".."`"..text1.."`".."\n"
.."📞@AnOnySeCuRiTy"
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, text, 1, 'md')
end
if input:match("^[#!/][Ff]wd$") then
tdcli.forwardMessages(chat_id, chat_id,{[0] = reply_id}, 0)
end
if input:match("^[#!/][Uu]sername") and is_sudo(msg) then
tdcli.changeUsername(string.sub(input, 11))
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<b>Username Changed To </b>@'..string.sub(input, 11), 1, 'html')
end