-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbot.lua
More file actions
4227 lines (3881 loc) · 219 KB
/
bot.lua
File metadata and controls
4227 lines (3881 loc) · 219 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'
redis = (loadfile "./libs/redis.lua")()
serpent = require('serpent')
tdcli = dofile('tdcli.lua')
serp = require 'serpent'.block
redis2 = require 'redis'
JSON = require('dkjson')
clr = require 'term.colors'
HTTP = require('socket.http')
HTTPS = require('ssl.https')
URL = require('socket.url')
clr = require 'term.colors'
db = redis2.connect('127.0.0.1', 6379)
sudo_users = {
294665580
}
local function info_username(extra, result, success)
vardump(result)
chat_id = db:get('chatid')
local function dl_photo(arg,data)
tdcli.sendPhoto(chat_id, 0, 0, 1, nil, data.photos_[0].sizes_[1].photo_.persistent_id_,result.id_..'\n'..result.type_.user_.first_name_)
end
tdcli_function ({ID = "GetUserProfilePhotos",user_id_ = result.id_,offset_ = 0,limit_ = 100000}, dl_photo, nil)
db:del('chatid')
end
local function info_user(username)
tdcli_function ({
ID = "SearchPublicChat",
username_ = username
}, info_username, extra)
end
function get_info(user_id)
if db:hget('bot:username',user_id) then
text = '@'..(string.gsub(db:hget('bot:username',user_id), 'false', '') or '')..' [<code>'..user_id..'</code>]'
end
get_user(user_id)
return text
--db:hrem('bot:username',user_id)
end
function get_user(user_id)
function dl_username(arg, data)
username = data.username or ''
--vardump(data)
db:hset('bot:username',data.id_,data.username_)
end
tdcli_function ({
ID = "GetUser",
user_id_ = user_id
}, dl_username, nil)
end
local function getMessage(chat_id, message_id,cb)
tdcli_function ({
ID = "GetMessage",
chat_id_ = chat_id,
message_id_ = message_id
}, cb, nil)
end
-----------------------------------------------------------------------------------------------
function sendPhoto(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, photo, caption)
tdcli_function ({
ID = "SendMessage",
chat_id_ = chat_id,
reply_to_message_id_ = reply_to_message_id,
disable_notification_ = disable_notification,
from_background_ = from_background,
reply_markup_ = reply_markup,
input_message_content_ = {
ID = "InputMessagePhoto",
photo_ = getInputFile(photo),
added_sticker_file_ids_ = {},
width_ = 0,
height_ = 0,
caption_ = caption
},
}, dl_cb, nil)
end
function addlist(msg)
if msg.content_.contact_.ID == "Contact" then
tdcli.importContacts(msg.content_.contact_.phone_number_, (msg.content_.contact_.first_name_ or '--'), '#bot', msg.content_.contact_.user_id_)--@Showeye
tdcli.sendMessage(msg.chat_id_, msg.id_, 0, 1, nil, '<b>You have been Added !</b>\n', 1, 'html')
end
end
function is_gbanned(msg)
local msg = data.message_
local chat_id = msg.chat_id_
local user_id = msg.sender_user_id_
local var = false
local hash = 'bot:gbanned:megacreed'
local banned = redis:sismember(hash, user_id)
if banned then
var = true
end
return var
end
function resolve_username(username,cb)
tdcli_function ({
ID = "SearchPublicChat",
username_ = username
}, cb, nil)
end
function changeChatMemberStatus(chat_id, user_id, status)
tdcli_function ({
ID = "ChangeChatMemberStatus",
chat_id_ = chat_id,
user_id_ = user_id,
status_ = {
ID = "ChatMemberStatus" .. status
},
}, dl_cb, nil)
end
function chat_kick(chat_id, user_id)
changeChatMemberStatus(chat_id, user_id, "Kicked")
end
function is_added(msg)
local var = false
if redis:sismember('groups:megacreed',msg.chat_id_) then
var = true
end
return var
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_admin(msg)
local user_id = msg.sender_user_id_
local var = false
local hashs = 'botadmins:megacreed'
local admin = redis:sismember(hashs, user_id)
if admin then
var = true
end
for k,v in pairs(sudo_users) do
if user_id == v then
var = true
end
end
return var
end
function serialize_to_file(data, file, uglify)
file = io.open(file, 'w+')
local serialized
if not uglify then
serialized = serpent.block(data, {
comment = false,
name = '_'
})
else
serialized = serpent.dump(data)
end
file:write(serialized)
file:close()
end
function is_normal(msg)
local chat_id = msg.chat_id_
local user_id = msg.sender_user_id_
local mutel = redis:sismember('muteusers:megacreed'..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_owners = redis:get('owners:megacreed'..chat_id)
if group_owners == tostring(user_id) then
var = true
end
if redis:sismember('botadmins:megacreed',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
--- promotes PM is ( Moderators )
function is_mod(msg)
local var = false
local chat_id = msg.chat_id_
local user_id = msg.sender_user_id_
if redis:sismember('promotes:megacreed'..chat_id,user_id) then
var = true
end
if redis:sismember('botadmins:megacreed',user_id) then
var = true
end
if redis:get('owners:megacreed'..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
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:megacreed'..ch)
redis:srem('owners:megacreed'..user,ch)
redis:set('owners:megacreed'..ch,user)
redis:sadd('owners:megacreed'..user,ch)
if redis:hget(result.chat_id_, "lang:megacreed") == "en" then
text = 'User : '..get_info(user)..' <b>Has been Promoted As Owner !</b>'
else
text = 'کاربر : \n'..get_info(user)..'\n <b>به عنوان مدير ارتقا يافت !</b>'
end
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, text, 1, 'html')
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:megacreed'..ch)
redis:srem('owners:megacreed'..msg.sender_user_id_,msg.chat_id_)
if redis:hget(result.chat_id_, "lang:megacreed") == "en" then
text = 'User : '..get_info(user)..' <b>Has Been De-Ownered !</b>'
else
text = 'کاربر : \n'..get_info(user)..'\n از مديريت عزل شد !'
end
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, text, 1, 'html')
print(user)
end
function kick_reply(extra, result, success)
if redis:sismember('promotes:megacreed'..result.chat_id_, result.sender_user_id_) then
if redis:hget(result.chat_id_, "lang:megacreed") == "en" then
text = '*You Can,t Kick Moderators !*'
else
text = '*شما نميتوانيد مدير و ناظم هارا حذف کنيد !*'
end
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, text, 1, 'md')
else
b = vardump(result)
tdcli.changeChatMemberStatus(result.chat_id_, result.sender_user_id_, 'Kicked')
if redis:hget(result.chat_id_, "lang:megacreed") == "en" then
text = '<b>Successfull !</b>\n User : '..get_info(result.sender_user_id_)..' <b> Has Been Kicked</b>'
else
text = '<b>تراکنش موفق !</b>\nکاربر : \n'..get_info(result.sender_user_id_)..'\n<b>از گروه حذف شد !</b>'
end
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, text, 1, 'md')
end
end
local function deleteMessagesFromUser(chat_id, user_id, cb, cmd)
tdcli_function ({
ID = "DeleteMessagesFromUser",
chat_id_ = chat_id,
user_id_ = user_id
},cb or dl_cb, cmd)
end
local function setmod_reply(extra, result, success)
local msg = result.id_
local user = result.sender_user_id_
local chat = result.chat_id_
redis:sadd('promotes:megacreed'..result.chat_id_, user)
if redis:hget(result.chat_id_, "lang:megacreed") == "en" then
text = 'User : '..get_info(user)..' <b>Has been Promoted !</b>'
else
text = 'کاربر : \n'..get_info(user)..'\n ارتقا يافت !'
end
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, text, 1, 'html')
end
local function remmod_reply(extra, result, success)
local msg = result.id_
local user = result.sender_user_id_
local chat = result.chat_id_
redis:srem('promotes:megacreed'..chat,user)
if redis:hget(result.chat_id_, "lang:megacreed") == "en" then
text = 'User : '..get_info(user)..' <b>Has been Demoted !</b>'
else
text = 'کاربر : \n'..get_info(user)..'\n عزل مقام شد !'
end
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, text, 1, 'html')
end
function ban_reply(extra, result, success)
if redis:sismember('promotes:megacreed'..result.chat_id_, result.sender_user_id_) then
if redis:hget(result.chat_id_, "lang:megacreed") == "en" then
text = '*You Can,t Ban Moderators !*'
else
text = '*شما نميتوانيد مدير و ناظم ها را بن کنيد !*'
end
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, text, 1, 'md')
else
if redis:hget(result.chat_id_, "lang:megacreed") == "en" then
text = 'User : '..result.sender_user_id_..' <b>Has been Banned !</b>'
else
text = 'کاربر : \n'..get_info(result.sender_user_id_)..'\n <b>بن شد !</b>'
end
tdcli.changeChatMemberStatus(result.chat_id_, result.sender_user_id_, 'Kicked')
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, text, 1, 'html')
end
end
local function setmute_reply(extra, result, success)
vardump(result)
if not redis:sismember('promotes:megacreed'..result.chat_id_, result.sender_user_id_) then
redis:sadd('muteusers:megacreed'..result.chat_id_,result.sender_user_id_)
if redis:hget(result.chat_id_, "lang:megacreed") == "en" then
text = '<b>Successfull !</b>\nUser : '..get_info(result.sender_user_id_)..' <b>Has been Muted !</b>\nStatus : <code>Cant Speak</code>'
else
text = '<b>تراکنش موفق !</b>\nکاربر : \n'..get_info(result.sender_user_id_)..'\n <b>به ليست ساکت ها اضافه شد !</b>\nوضعيت : <code>قادر به حرف زدن نميباشد</code>'
end
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, text, 1, 'html')
else
if redis:hget(result.chat_id_, "lang:megacreed") == "en" then
text = '<b>Error !</b>\n<b>You Can,t Mute Moderators !</b>'
else
text = '<b>خطا !</b>\n<b>شما نميتوانيد مدير يا ناظم هارا ساکت بکنيد !</b>'
end
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, text, 1, 'html')
end
end
local function demute_reply(extra, result, success)
--vardump(result)
redis:srem('muteusers:megacreed'..result.chat_id_,result.sender_user_id_)
if redis:hget(result.chat_id_, "lang:megacreed") == "en" then
text = '<b>Successfull !</b>\nUser : <code>('..result.sender_user_id_..')</code> <b>Has been UnMuted !</b>\nStatus : <code>He Can Speak Now</code>'
else
text = '<b>تراکنش موفق !</b>\nکاربر : \n'..get_info(result.sender_user_id_)..'\n <b>از ليست ساکت ها حذف شد !</b>\nوضعيت : <code> اکنون قادر به حرف زدن ميباشد</code>'
end
tdcli.sendText(result.chat_id_, 0, 0, 1, nil, text, 1, 'html')
end
function user_info(extra,result)
if result.user_.username_ then
username = '*Username :* @'..result.user_.username_..''
else
username = ''
end
local text = '<b>Firstname :</b> <code>'..(result.user_.first_name_ or 'none')..'</code>\n<b>Group ID : </b><code>'..extra.gid..'</code>\n<b>Your ID :</b> <code>'..result.user_.id_..'</code>\n<b>Your Phone : </b><code>'..(result.user_.phone_number_ or '<b>--</b>')..'</code>\n'..username
tdcli.sendText(extra.gid,extra.msgid, 0, 1, text, 1, 'html')
end
function idby_photo(extra,data)
--vardump(extra)
--vardump(data)
if redis:hget(extra.gid, "lang:megacreed") == "en" then
text = 'SuperGroup ID : '..string.sub(extra.gid, 5,14)..'\nUser ID : '..extra.uid..'\nChannel : @MegaCreedUpdates'
else
text = 'آيدي گروه : '..string.sub(extra.gid, 5,14)..'\nآيدي کاربر : '..extra.uid..'\nکانال ما : @MegaCreedUpdates'
end
tdcli.sendPhoto(extra.gid, 0, extra.id, 1, nil, data.photos_[0].sizes_[1].photo_.persistent_id_, text)
end
function get_msg(msgid,chatid,cb1,cb2)
return tdcli_function({ID = "GetMessage",chat_id_ = chatid,message_id_ = msgid}, cb1, cb2)
end
function get_pro(uid,cb1,cb2)
tdcli_function ({ID = "GetUserProfilePhotos",user_id_ = uid,offset_ = 0,limit_ = 1}, cb1, cb2)
end
function idby_reply(extra,data)
--vardump(extra)
--vardump(data)
local uid = data.sender_user_id_
get_pro(uid,idby_photo,{gid=extra.gid,uid=uid,id=extra.id})
end
function is_banned(msg)
local var = false
local msg = data.message_
local chat_id = msg.chat_id_
local user_id = msg.sender_user_id_
local hash = 'bot:banned:megacreed'..chat_id
local banned = redis:sismember(hash, user_id)
if banned then
var = true
end
return var
end
function tdcli_update_callback(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_
if msg.chat_id_ then
local id = tostring(msg.chat_id_)
if id:match('^(%d+)') then --- msg to group
-------------
if msg.content_.ID == "MessageChatAddMembers" or msg.content_.ID == "MessageChatJoinByLink" or msg.content_.ID == "MessageChatDeleteMember" then
if redis:get('lock_tgservice:megacreed'..msg.chat_id_) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_photo_ or msg.content_.animation_ or msg.content_.audio_ or msg.content_.document_ or msg.content_.video_ then
if msg.content_.caption_ and not is_mod(msg) then
if redis:get('lock_links:megacreed'..chat_id) and msg.content_.caption_:find("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/") or msg.content_.caption_:find("[Tt].[Mm][Ee]/") and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
if redis:get('lock_tag:megacreed'..chat_id) and msg.content_.caption_:find("#") and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
if redis:get('lock_username:megacreed'..chat_id) and msg.content_.caption_:find("@") and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
if redis:get('lock_persian:megacreed'..chat_id) and msg.content_.caption_:find("[\216-\219][\128-\191]") and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
local is_english_msg = msg.content_.caption_:find("[a-z]") or msg.content_.caption_:find("[A-Z]")
if redis:get('lock_english:megacreed'..chat_id) and is_english_msg and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
local is_fosh_msg = msg.content_.caption_:find("کير") or msg.content_.caption_:find("کص") or msg.content_.caption_:find("کس") or msg.content_.caption_:find("کون") or msg.content_.caption_:find("85") or msg.content_.caption_:find("جنده") or msg.content_.caption_:find("ننه") or msg.content_.caption_:find("ننت") or msg.content_.caption_:find("مادر") or msg.content_.caption_:find("قهبه") or msg.content_.caption_:find("گايي") or msg.content_.caption_:find("سکس") or msg.content_.caption_:find("kir") or msg.content_.caption_:find("kos") or msg.content_.caption_:find("kon") or msg.content_.caption_:find("nne") or msg.content_.caption_:find("nnt")
if redis:get('lock_fosh:megacreed'..chat_id) and is_fosh_msg and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
local is_emoji_msg = msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??") or msg.content_.caption_:find("??")
if redis:get('lock_emoji:megacreed'..chat_id) and is_emoji_msg and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
end
-----------
if msg.content_.game_ then
if redis:get('mute_game:megacreed'..chat_id) and msg.content_.game_ and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
---------
if msg.content_.ID == "MessageContact" and msg.content_.contact_ then
if redis:get('mute_contact:megacreed'..chat_id) or redis:get('mute_all:megacreed'..msg.chat_id_) then
if msg.content_.contact_ and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.ID == "MessageContact" then
tdcli.importContacts(msg.content_.contact_.phone_number_, (msg.content_.contact_.first_name_ or '--'), '#bot', msg.content_.contact_.user_id_)
redis:set('is:added:megacreed'..msg.sender_user_id_, "yes")
tdcli.sendText(msg.chat_id_, msg.id_, 0, 1, nil, '<b>You Have been added !</b>\n<b>Please Add My Number as it is shown on My profile !</b>\nشما به ليست مخاطبين بنده اضافه شديد\nلطفا شماره بنده را که روي اکانت بنده ظاهر شده است ذخيره بکنيد !', 1, 'html')
end
end
end
end
if msg.content_.caption_ then
if redis:get('lock_caption:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.animation_ then
if redis:get('mute_gif:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.photo_ then
if redis:get('mute_photo:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.audio_ then
if redis:get('mute_audio:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.voice_ then
if redis:get('mute_voice:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.video_ then
if redis:get('mute_video:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.document_ then
if redis:get('mute_document:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.location_ then
if redis:get('lock_location:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.forward_info_ then
if redis:get('lock_forward:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.contact_ then
if redis:get('mute_contact:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.location_ then
if redis:get('lock_location:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.sticker_ then
if redis:get('mute_sticker:megacreed'..chat_id) and not is_mod(msg) or redis:get('mute_all:megacreed'..msg.chat_id_) and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
if msg.content_.ID == "MessageText" then
if msg.content_.text_ then
if redis:get('mute_text:megacreed'..chat_id) or redis:get('mute_all:megacreed'..msg.chat_id_) then
if msg.content_.text_ and not is_mod(msg) then
tdcli.deleteMessages(chat_id, {[0] = msg.id_})
end
end
end
redis:incr("bot:usermsgs:megacreed"..msg.chat_id_..":"..msg.sender_user_id_)
redis:incr("bot:allgpmsgs:megacreed"..msg.chat_id_)
redis:incr("bot:allmsgs:megacreed")
if msg.chat_id_ then
local id = tostring(msg.chat_id_)
if id:match('-100(%d+)') then
if redis:get('markread'..msg.chat_id_) then
tdcli.viewMessages(chat_id, {[0] = msg.id_})
end
if msg.content_.text_:match("^/leave(-%d+)") and is_admin(msg) then
local txt = {string.match(msg.content_.text_, "^/(leave)(-%d+)$")}
tdcli.sendText(msg.chat_id_, msg.id_, 0, 1, nil, 'ربات با موفقيت از گروه '..txt[2]..' خارج شد.', 1, 'md')
tdcli.sendText(txt[2], 0, 0, 1, nil, 'ربات به دلايلي گروه را ترک ميکند\nبراي اطلاعات بيشتر ميتوانيد با @Mr_creed در ارتباط باشيد.\nدر صورت ريپورت بودن ميتوانيد با ربات زير به ما پيام دهيد\n@YousefTear_Bot\n\nChannel> @MegaCreedUpdates', 1, 'html')
tdcli.changeChatMemberStatus(txt[2], tonumber(239726711), 'Left')
end
if msg.content_.text_:match("^[Aa]dd$") and is_admin(msg) then
if redis:sismember('groups:megacreed',chat_id) then
return tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Group is Already added !*', 1, 'md')
end
tdcli.sendText(-1001105433602, 0, 0, 1, nil, '<b>New Group Has Been Added By :</b> '..get_info(msg.sender_user_id_)..'', 1, 'html')
redis:sadd('groups:megacreed',chat_id)
redis:setex("bot:charge:megacreed"..chat_id,2592000,true)
redis:set('floodtime:megacreed'..chat_id, tonumber(3))
redis:set("bot:enable:megacreed"..msg.chat_id_,true)
redis:set('floodnum:megacreed'..chat_id, tonumber(5))
redis:set('maxspam:megacreed'..chat_id, tonumber(2000))
redis:set('owners:megacreed'..chat_id, msg.sender_user_id_)
redis:sadd('owners:megacreed'..msg.sender_user_id_,msg.chat_id_)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<b>Group Has Been Added By</b> : '..get_info(msg.sender_user_id_)..' <b>And Adder Has been set as Owner !</b>', 1, 'html')
end
-------------------------------------------------------------------------------------------------------------------------------------------
if msg.content_.text_:match("^[Rr]em$") and is_admin(msg) then
if not redis:sismember('groups:megacreed',chat_id) then
return tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Group is not added !*', 1, 'md')
end
redis:srem('groups:megacreed',chat_id)
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<b>Group Has Been Removed By</b> : '..get_info(msg.sender_user_id_)..'', 1, 'html')
redis:del('owners:megacreed'..chat_id)
redis:srem('owners:megacreed'..msg.sender_user_id_,msg.chat_id_)
redis:del('promotes:megacreed'..chat_id)
redis:del('muteusers:megacreed'..chat_id)
redis:del('mute_user:megacreed'..chat_id)
redis:set('floodtime:megacreed'..chat_id, tonumber(3))
redis:set('floodnum:megacreed'..chat_id, tonumber(5))
redis:set('maxspam:megacreed'..chat_id, tonumber(2000))
redis:del('lock_username:megacreed'..chat_id)
redis:del('lock_links:megacreed'..chat_id)
redis:del('lock_bots:megacreed'..chat_id)
redis:del('lock_tag:megacreed'..chat_id)
redis:del('lock_forward:megacreed'..chat_id)
redis:del('lock_persian:megacreed'..chat_id)
redis:del('lock_english:megacreed'..chat_id)
redis:del('lock_fosh:megacreed'..chat_id)
redis:del('lock_location:megacreed'..chat_id)
redis:del('lock_edit:megacreed'..chat_id)
redis:del('lock_caption:megacreed'..chat_id)
redis:del('lock_emoji:megacreed'..chat_id)
redis:del('lock_inline:megacreed'..chat_id)
redis:del('lock_reply:megacreed'..chat_id)
redis:del('lock_tgservice:megacreed'..chat_id)
redis:del('lock_spam:megacreed'..chat_id)
redis:del('lock_flood:megacreed'..chat_id)
redis:del('mute_all:megacreed'..chat_id)
redis:del('mute_text:megacreed'..chat_id)
redis:del('mute_game:megacreed'..chat_id)
redis:del('mute_sticker:megacreed'..chat_id)
redis:del('mute_contact:megacreed'..chat_id)
redis:del('mute_gif:megacreed'..chat_id)
redis:del('mute_voice:megacreed'..chat_id)
redis:del('mute_weblink:megacreed'..chat_id)
redis:del('mute_markdown:megacreed'..chat_id)
redis:del('mute_keyboard:megacreed'..chat_id)
redis:del('mute_photo:megacreed'..chat_id)
redis:del('mute_audio:megacreed'..chat_id)
redis:del('mute_video:megacreed'..chat_id)
redis:del('mute_document:megacreed'..chat_id)
end
if not redis:sismember("bot:groupss:megacreed",msg.chat_id_) then
redis:sadd("bot:groupss:megacreed",msg.chat_id_)
end
if not redis:get("bot:charge:megacreed"..msg.chat_id_) then
redis:set('bot:disable:megacreed'..msg.chat_id_, true)
if redis:get("bot:enable:megacreed"..msg.chat_id_) then
redis:del("bot:enable:megacreed"..msg.chat_id_)
tdcli.sendText(-1001105433602, 0, 0, 1, nil, "شارژ اين گروه به اتمام رسيد \nLink : "..(redis:get("bot:group:link"..msg.chat_id_) or "تنظيم نشده").."\nID : "..msg.chat_id_..'\n\nدر صورتي که ميخواهيد ربات اين گروه را ترک کند از دستور زير استفاده کنيد\n\n/leave'..msg.chat_id_..'\nبراي جوين دادن توي اين گروه ميتوني از دستور زير استفاده کني:\n/join'..msg.chat_id_..'\n_________________\nدر صورتي که ميخواهيد گروه رو دوباره شارژ کنيد ميتوانيد از کد هاي زير استفاده کنيد...\n\n<code>براي شارژ 1 ماهه:</code>\n/plan1'..msg.chat_id_..'\n\n<code>براي شارژ 3 ماهه:</code>\n/plan2'..msg.chat_id_..'\n\n<code>براي شارژ نامحدود:</code>\n/plan3'..msg.chat_id_, 1, 'html')
tdcli.sendText(msg.chat_id_, 0,0, 1,nil, 'شارژ اين گروه به اتمام رسيده است !\nربات تا زمانيکه گروه شارژ نشود کار نخواهد کرد\nبراي شارژ کردن گروه خود به @Mr_creed مراجعه نماييد !\nکانال ما > @MegaCreedUpdates', 1, 'html')
end
end
redis:sadd("gp:users", msg.sender_user_id_)
end
if id:match('^(%d+)') then
if not redis:get('user:limits:megacreed'..msg.sender_user_id_) then
redis:set('user:limits:megacreed'..msg.sender_user_id_, 3)
end
--------------------------------------------------------
------------------ if msg to PV bot --------------------
----------------------------------------------------------
if msg.content_.text_:match("^([Cc]reator)$") then
tdcli.sendText(msg.chat_id_, msg.id_, 0, 1, nil, "<b>Creator : </b>@Mr_Creed\n<b>Channel : </b>@IR_TeaM\n\nسازنده : @Mr_Creed\nکانال : @IR_TeaM", 1, "html")
end
if msg.content_.text_:match("^([Ii][Dd])$") then
local matches = {msg.content_.text_:match("^([Ii][Dd]) (.*)")}
local gid = tonumber(msg.chat_id_)
local uid = tonumber(msg.sender_user_id_)
local reply = msg.reply_to_message_id_
if not matches[2] and reply == 0 then
local function dl_photo(arg,data)
if redis:hget(msg.chat_id_, "lang:megacreed") == "en" then
text = 'Bot ID : '..msg.chat_id_..'\nYour ID : '..msg.sender_user_id_..'\nChannel : @MegaCreedUpdates'
else
text = 'آيدي ربات : '..msg.chat_id_..'\nآيدي کاربر : '..msg.sender_user_id_..'\nکانال ما : @MegaCreedUpdates'
end
tdcli.sendPhoto(msg.chat_id_, msg.id_, 0, 1, nil, data.photos_[0].sizes_[1].photo_.persistent_id_, text)
end
tdcli_function ({ID = "GetUserProfilePhotos",user_id_ = msg.sender_user_id_,offset_ = 0,limit_ = 1}, dl_photo, nil)
return
elseif reply ~= 0 then
get_msg(reply,gid,idby_reply,{gid=gid,id=reply})
end
end
if not redis:sismember("bot:userss:megacreed",msg.chat_id_) then
redis:set('user:limits:megacreed'..msg.sender_user_id_, 3)
local txthelppv = [[
به پیوی من خوش آمدید دوست عزیز !
این یک ربات هوشمند لینک پاک کن و فحش پاک کن و ... میباشد که ماهانه به گروه ها با هزینه ی مناسب اجاره داده میشود تا در مدیریت گروه ها به شما کمک نماید !
برای خرید به ایدی : @Mr_creed پیام بدهید !
جهت دیدن آپدیت ها و مشخصات دیگر در کانال @MegaCreedUpdates عضو شوید تا آگاه بمانید !
]]
tdcli.sendText(msg.chat_id_, msg.id_, 0, 1, nil, txthelppv , 1, "md")
redis:sadd("bot:userss:megacreed" , msg.chat_id_)
end
---------------------------------------------------------
------------------ End of Msg Pv Bot --------------------
---------------------------------------------------------
end
end
----------------------------------------------------------------------------------------__
if msg and redis:sismember('bot:banned:megacreed'..msg.chat_id_, msg.sender_user_id_) then
print("Baned user")
chat_kick(msg.chat_id_, msg.sender_user_id_)
end
if msg and redis:sismember('bot:gbanned:megacreed', msg.sender_user_id_) then
print("Gbaned user")
chat_kick(msg.chat_id_, msg.sender_user_id_)
end
if msg.content_.text_:match("^report") and msg.reply_to_message_id_ then
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Done !*\n*User Report Has been Sent to :* '..redis:get('owners:megacreed'..msg.chat_id_)..'', 1, 'md')
tdcli.sendText(redis:get('owners:megacreed'..msg.chat_id_), 0, 0, 1, nil, '*Reporter :* '..msg.sender_user_id_..'\n\nSended Message :', 1, 'md')
tdcli.forwardMessages(redis:get('owners:megacreed'..msg.chat_id_), chat_id,{[0] = reply_id}, 0)
end
if msg.content_.text_:match("^stats$") and is_admin(msg) then
local gps = redis:scard("bot:groupss:megacreed")
local users = redis:scard("bot:userss:megacreed")
local allmgs = redis:get("bot:allmsgs:megacreed")
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '*Stats*\n\n_> Groups: _ `'..gps..'`\n_> Users: _ `'..users..'`\n_> All msgs: _ `'..allmgs..'`', 1, 'md')
end
---------------------------------------------------------------------------------------------------------------------------------
if msg.content_.text_:match("^([Ii][Dd]) (.*)$") then
local matchees = {msg.content_.text_:match("^([Ii][Dd]) (.*)$")}
local gid = tonumber(msg.chat_id_)
local uid = matchees[2]
local function getid_photo(extra, result, success)
tdcli.sendPhoto(result.chat_id_, result.id_, 0, 1, nil, result.photos_[0].sizes_[1].photo_.persistent_id_, 'Here ID : '..result.chat_id_..'\nHis ID : '..result.sender_user_id_..'\nChannel : @MegaCreedUpdates')
end
resolve_username(matchees[2], getid_photo)
end
if msg.content_.text_:match("^[Rr]eload$") and is_sudo(msg) then
io.popen("sudo killall tg")
tdcli.sendText(chat_id, msg.id_, 0, 1, nil, '<b>Bot Has been Reloaded !</b>', 1, 'html')
end
if msg.content_.text_:match("^bcgp (.*)") and is_sudo(msg) then
for k,v in pairs(redis:smembers("bot:groupss:megacreed")) do
tdcli.sendText(v, 0, 0, 1, nil, msg.content_.text_:match("^bcgp (.*)"), 1 , 'html')
end
return
end
if msg.content_.text_:match("^bcuser (.*)") and is_sudo(msg) then
for k,v in pairs(redis:smembers("bot:userss:megacreed")) do
tdcli.sendText(v, 0, 0, 1, nil, msg.content_.text_:match("^bcuser (.*)"), 1 , 'html')
end
return
end
-----------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------
if not is_added(msg) then
if redis:get('autoleave') == "on" then
if msg and not is_admin(msg) then
if redis:hget(msg.chat_id_, "lang:megacreed") == "en" then
text = '*Bot Leaves This Group !*\n*Reason :* `This is Not one of my Groups !`'
else
text = '*ربات اين گروه را ترک ميکند !*\n*علت :* `اين گروه جزو گروه هاي ربات نميباشد !`'
end
tdcli.sendText(msg.chat_id_, msg.id_, 0 ,1 , nil, text, 1, 'md')
tdcli.changeChatMemberStatus(chat_id, tonumber(239726711), 'Left')
end
end
else
--------------------------- is added Group now ------------------------------
if msg.content_.text_:match("^charge (%d+)$") and is_admin(msg) then
local day = tonumber(86400)
local a = {string.match(msg.content_.text_, "^(charge) (%d+)$")}
tdcli.sendText(msg.chat_id_, msg.id_, 0 ,1 , nil, '*Group Charged for* : `'..a[2]..'` *Days !*', 1, 'md')
local time = a[2] * day
redis:setex("bot:charge:megacreed"..msg.chat_id_,time,true)
redis:set("bot:enable:megacreed"..msg.chat_id_,true)
redis:del('bot:disable:megacreed'..msg.chat_id_)
end
---------------------------------------------------------------------------------------------
if msg.content_.text_:match("^chargesec (%d+)$") and is_admin(msg) then
redis:del('bot:disable:megacreed'..msg.chat_id_)
local day = tonumber(1)
local a = {string.match(msg.content_.text_, "^(chargesec) (%d+)$")}
tdcli.sendText(msg.chat_id_, msg.id_, 0 ,1 , nil, '*Group Charged for* : `'..a[2]..'` *Seconds !*', 1, 'md')
local time = a[2] * day
redis:setex("bot:charge:megacreed"..msg.chat_id_,time,true)
redis:set("bot:enable:megacreed"..msg.chat_id_,true)
end
---------------------------------------------------------------------------------------------
if msg.content_.text_:match("^charge stats") and is_mod(msg) then
local ex = redis:ttl("bot:charge:megacreed"..msg.chat_id_)
if ex == -1 then
tdcli.sendText(msg.chat_id_, msg.id_, 0 ,1 , nil ,'*Unlimited !*', 1, 'md')
else
local day = tonumber(86400)
local d = math.floor(ex / day ) + 1
if redis:hget(msg.chat_id_, "lang:megacreed") == "en" then
text = "*After* `"..d.."` *Days Later Group Will be Expired !*"
else
text = "* شارژ اين گروه بعد از * `"..d.."` *روز ديگر به اتمام ميرسد !*"
end
tdcli.sendText(msg.chat_id_, msg.id_, 0 ,1 , nil , text, 1, 'md')
end
end
---------------------------------------------------------------------------------------------
if msg.content_.text_:match("^charge stats (%d+)") and is_admin(msg) then
local txt = {string.match(msg.content_.text_, "^(charge stats) (%d+)$")}
local ex = redis:ttl("bot:charge:megacreed"..txt[2])
if ex == -1 then
if redis:hget(msg.chat_id_, "lang:megacreed") == "en" then
text = '*Unlimited !*'
else
text = '*نامحدود !*'
end
tdcli.sendText(msg.chat_id_, msg.id_, 0 ,1 , nil ,text, 1, 'md')
else
local day = tonumber(86400)
local d = math.floor(ex / day ) + 1
if redis:hget(msg.chat_id_, "lang:megacreed") == "en" then
text = "*After* `"..d.."` *Days Later Group Will be Expired !*"
else
text = "* شارژ اين گروه بعد از * `"..d.."` *روز ديگر به اتمام ميرسد !*"
end
tdcli.sendText(msg.chat_id_, msg.id_, 0 ,1 , nil ,text, 1, 'md')
end
end
---------------------------------------------------------------------------------------------
if is_sudo(msg) then
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
if msg.content_.text_:match('^/plan1(-%d+)') and is_admin(msg) then
local txt = {string.match(msg.content_.text_, "^/(plan1)(-%d+)$")}
local timeplan1 = 2592000
redis:setex("bot:charge:megacreed"..txt[2],timeplan1,true)
redis:del('bot:disable:megacreed'..txt[2])
tdcli.sendText(msg.chat_id_, msg.id_, 0, 1,nil, 'پلن 1 با موفقيت براي گروه '..txt[2]..' فعال شد\nاين گروه تا 30 روز ديگر اعتبار دارد! ( 1 ماه )', 1, 'md')
tdcli.sendText(txt[2], 0, 0, 1,nil, 'ربات با موفقيت فعال شد و تا 30 روز ديگر اعتبار دارد!', 1, 'md')
for k,v in pairs(sudo_users) do
tdcli.sendText(v, 0, 0,1,nil, "*User :* "..get_info(msg.sender_user_id_).." *Used a New Plan For a Group !*\n*Group id :* "..txt[2].."" , 1, 'md')
end
redis:set("bot:enable:megacreed"..txt[2],true)
end
---------------------------------------------------------------------------------------------
if msg.content_.text_:match('^/plan2(-%d+)') and is_admin(msg) then
local txt = {string.match(msg.content_.text_, "^/(plan2)(-%d+)$")}
local timeplan2 = 7776000
redis:del('bot:disable:megacreed'..txt[2])
redis:setex("bot:charge:megacreed"..txt[2],timeplan2,true)
tdcli.sendText(msg.chat_id_, msg.id_,0,1,nil, 'پلن 2 با موفقيت براي گروه '..txt[2]..' فعال شد\nاين گروه تا 90 روز ديگر اعتبار دارد! ( 3 ماه )', 1, 'md')
tdcli.sendText(txt[2], 0, 0, 1,nil, 'ربات با موفقيت فعال شد و تا 90 روز ديگر اعتبار دارد!', 1, 'md')
for k,v in pairs(sudo_users) do
tdcli.sendText(v, 0, 0,1,nil, "*User :* "..get_info(msg.sender_user_id_).." *Used a New Plan For a Group !*\n*Group id :* "..txt[2].."" , 1, 'md')
end
redis:set("bot:enable:megacreed"..txt[2],true)
end
---------------------------------------------------------------------------------------------
if msg.content_.text_:match('^/plan3(-%d+)') and is_admin(msg) then
local txt = {string.match(msg.content_.text_, "^/(plan3)(-%d+)$")}
redis:set("bot:charge:megacreed"..txt[2],true)
redis:del('bot:disable:megacreed'..txt[2])
tdcli.sendText(msg.chat_id_, msg.id_,0, 1,nil, 'پلن 3 با موفقيت براي گروه '..txt[2]..' فعال شد\nاين گروه به صورت نامحدود شارژ شد!', 1, 'md')
tdcli.sendText(txt[2], 0,0, 1,nil,'ربات بدون محدوديت فعال شد ! ( نامحدود )', 1, 'md')
for k,v in pairs(sudo_users) do
tdcli.sendText(v, 0, 0,1,nil, "*User :* "..get_info(msg.sender_user_id_).." *Used a New Plan For a Group !*\n*Group id :* "..txt[2].."" , 1, 'md')
end
redis:set("bot:enable:megacreed"..txt[2],true)
end
if msg.content_.text_:match('/join(-%d+)') and is_admin(msg) then
local txt = {string.match(msg.content_.text_, "^/(join)(-%d+)$")}
redis:set('admin',msg.sender_user_id_)
tdcli.sendText(msg.chat_id_, msg.id_,0, 1,nil, 'با موفقيت تورو به گروه '..txt[2]..' اضافه کردم.', 1, 'md')
tdcli.sendText(txt[2], 0, 0, 1,nil, 'ادمین ربات وارد گروه میشود ! \nادمین :'..get_info(redis:get('admin')), 1, 'md')
tdcli.addChatMember(txt[2], msg.sender_user_id_, 10)
end
end
---------------------------------------------------------------------------------------------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
--- Rmsg , Clean [Bots, Modlist , Rules] , Id , Owner , Moderators , Kick , Ban , Muteuser ----
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
-------------[[_______________________________________________________________________]]------------------
---------------------------------------------------------------------------------------------------------
if redis:get('bot:disable:megacreed'..msg.chat_id_) then
return
else
if not redis:hget(msg.chat_id_, "lang:megacreed") then
redis:hset(msg.chat_id_,"lang:megacreed", "en")
end
--[[if redis:hget('gp:cmd'..msg.chat_id_) == 0 then
redis:hset('gp:cmd'..msg.chat_id_, "mod")
end]]