forked from fianchiks/MAS-WarThunder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathline-tcr.py
More file actions
1749 lines (1655 loc) · 76.4 KB
/
line-tcr.py
File metadata and controls
1749 lines (1655 loc) · 76.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
import time,random,sys,json,codecs,threading,glob,re
cl = LINETCR.LINE()
cl.login(qr=True)
cl.loginResult()
kk = LINETCR.LINE()
kk.login(token="ElJl9jEZ2a00PphlgyF4.rGnjiTwph3BZhrtJd0WtLa.p4VJrylI7vRtV/GCvWzDfz2aJFyOGR8u8zLRZpk1GGE=")
kk.loginResult()
ki = LINETCR.LINE()
ki.login(token="EluEVHqxj9iB8emn7z28.MinrOAgI3TOt5KJCXQX+Aa.LMn5dWRIOAzMj7he8g4KQbCc5n4dNf1FU0r0ina+whA=")
ki.loginResult()
kc = LINETCR.LINE()
kc.login(token="ElAA0BQG4kDryOSR6503.biRLhTNOFtsbwVm5XIYpiW.RI4jB5Adz6tvzopL9xaS7lK4tSqyA/E/32ofbSx+Tl8=")
kc.loginResult()
cl
# adm = LineAlpha.LINE()
# adm.login(token="EkoRa4LbxQLepMyWmEMe.idD7rqcO/flZ+HSQWA/z7G.Z0Nd273uZOb1aD1eeTNA0FVr1/dN5ja7KuqCAyZlQFg=")
# adm.loginResult()
#client_id = '511abc94ee71658'
#client_secret = '948a2fcdbf566c04bcce5f990e349ce795ee7460'
#access_token = '30181acf5583ad6a215b4f69e6e5c7bc5c66efdb'
#refresh_token = '4a6b3f983b96714c2e9b581edf86f86e0d681938'
#client = ImgurClient(client_id, client_secret, access_token, refresh_token)
print "login success"
reload(sys)
sys.setdefaultencoding('utf-8')
#album = None
#image_path = 'tmp/tmp.jpg'
# kk=ki=kc=cl
helpMessage ="""Ghoul Bot(s)
Use Prefix 「Ghoul」 to use the Bot(s)
Prefix is Case sensitive but the commands is not.
[Gid] - Show Group ID
[Mid all] - Show all the Bot(s) MID
[Bot 1/2/3/4/5] - Shows the specific Bot MID
[Bot all] - Show all the Bot(s) Contact
[Bot 1/2/3/4/5] - Shows the specific Bot Contact
[Yid] - Show your ID
[Contact 「mid」] - Give Contact by MID
[Join on/off] - Auto join group
[Leave on/off] - Allows the bot to leave the group
[*] Command in the groups [*]
[Ginfo] - Group Info
[Banlist] - Check Banlist
[Cancel] - Cancel all pending(s) invitation
[Stalk 「ID」] - Upload lastest instagram picture from ID
[*] Admin and Staff Commands [*]
[Bot Absen] - Check if bot is Online
[Auto Url On/Off] - Turn invitation link for group on/off
[Auto Cancel On/Off] - Turn auto cancel invite on/off
[Gn 「group name」] - Change Group Name
[Speed] - Check bot response speed
[Gh Random:「A」] - Randomize group name A times
[Bc 「text」] - Let the bot send a text
[*] Admin only Commands [*]
[Clear group] - Clear all members in the group
[@Bye All] - Bot Leave
[@Bye Bot 1/2/3/4] - Bot Leave
[Ban 「@」] - Ban By Tag
[Unban 「@」] - Unban By Tag
[Ban] - By Sharing Contact
[Unban] - By Sharing Contact
[Kill ban] - Kick all banned contact(s)
[Staff add/remove @] - Add or Remove Staff By Tag
"""
KAC=[cl,ki,kk,kc]
mid = cl.getProfile().mid
Amid = kk.getProfile().mid
Bmid = ki.getProfile().mid
Cmid = kc.getProfile().mid
Bots = [mid,Amid,Bmid,Cmid,]
admin = ["u5aa2d0aa38b6566631c797f0334ae415","u85326fcaa03d37e33403c3281943aaef","u3a8f175f00cd198a04be74e8ea90dec5"]
staff = ["u5aa2d0aa38b6566631c797f0334ae415","u85326fcaa03d37e33403c3281943aaef","u3a8f175f00cd198a04be74e8ea90dec5"]
adminMID = "u5aa2d0aa38b6566631c797f0334ae415"
wait = {
'contact':True,
'autoJoin':True,
'autoCancel':{"on":True,"members":1},
'leaveRoom':True,
'timeline':True,
'autoAdd':True,
'message':"Thanks for add me",
"lang":"JP",
"comment":"Thanks for add me",
"commentOn":False,
"commentBlack":{},
"wblack":False,
"dblack":False,
"clock":True,
"cName":"Ghoul Vokster",
"cName2":"Ghoul Berster",
"cName3":"Ghoul Gifster",
"cName4":"Ghoul Flipster",
"blacklist":{},
"wblacklist":False,
"dblacklist":False,
"protectionOn":True
}
wait2 = {
'readPoint':{},
'readMember':{},
'setTime':{},
'ROM':{}
}
cancelinvite = {
'autoCancel':True,
'autoCancelUrl':True
}
#bot1_name = {
# "1" : "[Ardh-]BOT1",
# "2" : "Ardh-]BOT1[",
# "3" : "rdh-]BOT1[A",
# "4" : "dh-]BOT1[Ar",
# "5" : "h-]BOT1[Ard",
# "6" : "-]BOT1[Ardh",
# "7" : "]BOT1[Ardh-",
# "8" : "BOT1[Ardh-]",
# "9" : "OT1[Ardh-]B",
# "10" : "T1[Ardh-]BO",
# "11" : "1[Ardh-]BOT"
#}
#bot2_name = {
# "1" : "[Ardh-]BOT2",
# "2" : "Ardh-]BOT2[",
# "3" : "rdh-]BOT2[A",
# "4" : "dh-]BOT2[Ar",
# "5" : "h-]BOT2[Ard",
# "6" : "-]BOT2[Ardh",
# "7" : "]BOT2[Ardh-",
# "8" : "BOT2[Ardh-]",
# "9" : "OT2[Ardh-]B",
# "10" : "T2[Ardh-]BO",
# "11" : "2[Ardh-]BOT"
#}
#bot3_name = {
# "1" : "[Ardh-]BOT3",
# "2" : "Ardh-]BOT3[",
# "3" : "rdh-]BOT3[A",
# "4" : "dh-]BOT3[Ar",
# "5" : "h-]BOT3[Ard",
# "6" : "-]BOT3[Ardh",
# "7" : "]BOT3[Ardh-",
# "8" : "BOT3[Ardh-]",
# "9" : "OT3[Ardh-]B",
# "10" : "T3[Ardh-]BO",
# "11" : "3[Ardh-]BOT"
#}
#bot4_name = {
# "1" : "[Ardh-]BOT4",
# "2" : "Ardh-]BOT4[",
# "3" : "rdh-]BOT4[A",
# "4" : "dh-]BOT4[Ar",
# "5" : "h-]BOT4[Ard",
# "6" : "-]BOT4[Ardh",
# "7" : "]BOT4[Ardh-",
# "8" : "BOT4[Ardh-]",
# "9" : "OT4[Ardh-]B",
# "10" : "T4[Ardh-]BO",
# "11" : "4[Ardh-]BOT"
#}
#bot5_name = {
# "1" : "[Ardh-]BOT5",
# "2" : "Ardh-]BOT5[",
# "3" : "rdh-]BOT5[A",
# "4" : "dh-]BOT5[Ar",
# "5" : "h-]BOT5[Ard",
# "6" : "-]BOT5[Ardh",
# "7" : "]BOT5[Ardh-",
# "8" : "BOT5[Ardh-]",
# "9" : "OT5[Ardh-]B",
# "10" : "T5[Ardh-]BO",
# "11" : "5[Ardh-]BOT"
#}
setTime = {}
setTime = wait2['setTime']
#def upload_tempimage(client):
# '''
# Upload a picture of a kitten. We don't ship one, so get creative!
# '''
# Here's the metadata for the upload. All of these are optional, including
# this config dict itself.
# config = {
# 'album': album,
# 'name': 'bot auto upload',
# 'title': 'bot auto upload',
# 'description': 'bot auto upload'
# }
# print("Uploading image... ")
# image = client.upload_from_path(image_path, config=config, anon=False)
# print("Done")
# print()
# return image
def sendMessage(to, text, contentMetadata={}, contentType=0):
mes = Message()
mes.to, mes.from_ = to, profile.mid
mes.text = text
mes.contentType, mes.contentMetadata = contentType, contentMetadata
if to not in messageReq:
messageReq[to] = -1
messageReq[to] += 1
def NOTIFIED_READ_MESSAGE(op):
try:
if op.param1 in wait2['readPoint']:
Name = cl.getContact(op.param2).displayName
if Name in wait2['readMember'][op.param1]:
pass
else:
wait2['readMember'][op.param1] += "\n・" + Name
wait2['ROM'][op.param1][op.param2] = "・" + Name
else:
pass
except:
pass
def bot(op):
try:
if op.type == 0:
return
if op.type == 11:
if cancelinvite["autoCancelUrl"] == True:
if cl.getGroup(op.param1).preventJoinByTicket == False:
if op.param2 in Bots:
pass
if op.param2 in admin:
pass
else:
cl.kickoutFromGroup(op.param1,[op.param2])
wait["blacklist"][op.param2] = True
cl.reissueGroupTicket(op.param1)
X = cl.getGroup(op.param1)
X.preventJoinByTicket = True
cl.updateGroup(X)
print "Url Opened, Autokick on"
else:
print "random group update"
else:
pass
if op.type == 13:
if mid in op.param3:
if wait["autoJoin"] == True:
cl.acceptGroupInvitation(op.param1)
print "BOT 1 Joined"
else:
print "autoJoin is Off"
if Amid in op.param3:
if wait["autoJoin"] == True:
kk.acceptGroupInvitation(op.param1)
print "BOT 2 Joined"
else:
print "autoJoin is Off"
if Bmid in op.param3:
if wait["autoJoin"] == True:
ki.acceptGroupInvitation(op.param1)
print "BOT 3 Joined"
else:
print "autoJoin is Off"
if Cmid in op.param3:
if wait["autoJoin"] == True:
kc.acceptGroupInvitation(op.param1)
print "BOT 4 Joined"
else:
print "autoJoin is Off"
else:
if cancelinvite["autoCancel"] == True:
try:
X = cl.getGroup(op.param1)
gInviMids = [contact.mid for contact in X.invitee]
cl.cancelGroupInvitation(op.param1, gInviMids)
print gInviMids + "invite canceled"
except:
try:
print "Retry canceling invitation"
X = random.choice(KAC).getGroup(op.param1)
gInviMids = [contact.mid for contact in X.invitee]
random.choice(KAC).cancelGroupInvitation(op.param1, gInviMids)
print gInviMids + "invite canceled"
except:
print "Bot can't cancel the invitation"
pass
if op.type == 15:
random.choice(KAC).sendText(op.param1, "Good Bye :)")
print op.param3 + "has left the group"
if op.type == 17:
if op.param3 in wait["blacklist"]:
try:
cl.kickoutFromGroup(op.param1, op.param3)
except:
random.choice(KAC).kickoutFromGroup(op.param1, op.param3)
if op.type == 19:
print "someone was kicked"
if op.param3 in admin:
print "Admin has been kicked"
if op.param2 in Bots:
pass
else:
cl.kickoutFromGroup(op.param1,[op.param2])
wait["blacklist"][op.param2] = True
print "kicker kicked"
try:
cl.inviteIntoGroup(op.param1,op.param3)
adm.acceptGroupInvitation(op.param1)
except:
random.choice(KAC).inviteIntoGroup(op.param1,op.param3)
adm.acceptGroupInvitation(op.param1)
print "Admin Joined"
if mid in op.param3:
print "BOT1 has been kicked"
if op.param2 in Bots:
pass
if op.param2 in admin:
pass
else:
cl.kickoutFromGroup(op.param1,[op.param2])
wait["blacklist"][op.param2] = True
print "kicker kicked"
try:
kk.inviteIntoGroup(op.param1,op.param3)
cl.acceptGroupInvitation(op.param1)
except:
random.choice(KAC).inviteIntoGroup(op.param1,op.param3)
cl.acceptGroupInvitation(op.param1)
print "BOT1 Joined"
if Amid in op.param3:
print "BOT2 has been kicked"
if op.param2 in Bots:
pass
if op.param2 in admin:
pass
else:
cl.kickoutFromGroup(op.param1,[op.param2])
wait["blacklist"][op.param2] = True
print "kicker kicked"
try:
ki.inviteIntoGroup(op.param1,op.param3)
kk.acceptGroupInvitation(op.param1)
except:
random.choice(KAC).inviteIntoGroup(op.param1,op.param3)
kk.acceptGroupInvitation(op.param1)
print "BOT2 Joined"
if Bmid in op.param3:
print "BOT3 has been kicked"
if op.param2 in Bots:
pass
if op.param2 in admin:
pass
else:
cl.kickoutFromGroup(op.param1,[op.param2])
wait["blacklist"][op.param2] = True
print "kicker kicked"
try:
kc.inviteIntoGroup(op.param1,op.param3)
ki.acceptGroupInvitation(op.param1)
except:
random.choice(KAC).inviteIntoGroup(op.param1,op.param3)
ki.acceptGroupInvitation(op.param1)
print "BOT3 Joined"
if Cmid in op.param3:
print "BOT4 has been kicked"
if op.param2 in Bots:
pass
if op.param2 in admin:
pass
else:
cl.kickoutFromGroup(op.param1,[op.param2])
wait["blacklist"][op.param2] = True
print "kicker kicked"
try:
kg.inviteIntoGroup(op.param1,op.param3)
kc.acceptGroupInvitation(op.param1)
except:
random.choice(KAC).inviteIntoGroup(op.param1,op.param3)
kc.acceptGroupInvitation(op.param1)
print "BOT4 Joined"
else:
cl.kickoutFromGroup(op.param1,[op.param2])
kk.kickoutFromGroup(op.param1,[op.param2])
ki.kickoutFromGroup(op.param1,[op.param2])
kc.kickoutFromGroup(op.param1,[op.param2])
wait["blacklist"][op.param2] = True
print "autokick executed"
if op.type == 22:
if wait["leaveRoom"] == True:
cl.leaveRoom(op.param1)
print "BOT(s) Leaving chat Room"
if op.type == 24:
if wait["leaveRoom"] == True:
cl.leaveRoom(op.param1)
print "BOT(s) Leaving chat Room"
if op.type == 26:
msg = op.message
if msg.contentType == 13:
if wait["wblacklist"] == True:
if msg.contentMetadata["mid"] in wait["blacklist"]:
cl.sendText(msg.to,"Already in the Blacklist")
wait["wblacklist"] = False
print "MID Already in the Blacklist"
else:
wait["blacklist"][msg.contentMetadata["mid"]] = True
wait["wblacklist"] = False
cl.sendText(msg.to,"Added to the Blacklist")
print [msg.contentMetadata["mid"]] + " Added to the Blacklist"
elif wait["dblacklist"] == True:
if msg.contentMetadata["mid"] in wait["blacklist"]:
del wait["blacklist"][msg.contentMetadata["mid"]]
cl.sendText(msg.to,"Deleted from the Blacklist")
wait["dblacklist"] = False
print [msg.contentMetadata["mid"]] + " Removed from the Blacklist"
else:
wait["dblacklist"] = False
cl.sendText(msg.to,"Contact not in Blacklist")
print "MID not in blacklist"
elif wait["contact"] == True:
if msg.from_ in admin:
msg.contentType = 0
if 'displayName' in msg.contentMetadata:
contact = cl.getContact(msg.contentMetadata["mid"])
try:
cu = cl.channel.getCover(msg.contentMetadata["mid"])
except:
cu = ""
cl.sendText(msg.to,"[Display Name]:\n" + msg.contentMetadata["displayName"] + "\n\n[MID]:\n" + msg.contentMetadata["mid"] + "\n\n[Status Message]:\n" + contact.statusMessage + "\n\n[Profile Picture]:\nhttp://dl.profile.line-cdn.net/" + contact.pictureStatus + "\n\n[Cover Picture]:\n" + str(cu))
print "Contact sent"
else:
contact = cl.getContact(msg.contentMetadata["mid"])
try:
cu = cl.channel.getCover(msg.contentMetadata["mid"])
except:
cu = ""
cl.sendText(msg.to,"[displayName]:\n" + contact.displayName + "\n\n[MID]:\n" + msg.contentMetadata["mid"] + "\n\n[Status Message]:\n" + contact.statusMessage + "\n\n[Profile Picture]:\nhttp://dl.profile.line-cdn.net/" + contact.pictureStatus + "\n\n[Cover Picture]:\n" + str(cu))
print "Contact sent"
#-----------------------[Help Section]------------------------
elif msg.text in ["/help","/Help"]:
if wait["lang"] == "JP":
random.choice(KAC).sendText(msg.to,helpMessage)
print "[Command]/help executed"
else:
cl.sendText(msg.to,helpt)
#-----------------------[Group Name Section]------------------------
elif "Gh gn " in msg.text:
if msg.toType == 2:
if msg.from_ in staff:
X = cl.getGroup(msg.to)
X.name = msg.text.replace("Gh Gn ","")
random.choice(KAC).updateGroup(X)
print "[Command]Gn executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Staff or higher permission required.")
print "[Error]Command denied - staff or higher permission required"
else:
cl.sendText(msg.to,"It can't be used besides the group.")
print "Gn executed outside group chat"
elif "Gh gn " in msg.text:
if msg.toType == 2:
if msg.from_ in staff:
X = cl.getGroup(msg.to)
X.name = msg.text.replace("Gh gn ","")
random.choice(KAC).updateGroup(X)
print "[Command]Gn executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Staff or higher permission required.")
print "[Error]Command denied - staff or higher permission required"
else:
cl.sendText(msg.to,"It can't be used besides the group.")
print "Gn executed outside group chat"
#-----------------------[Kick Section]------------------------
elif "Gh kick " in msg.text:
if msg.from_ in admin:
midd = msg.text.replace("Gh kick ","")
cl.sendText(msg.to,"Good bye.")
random.choice(KAC).kickoutFromGroup(msg.to,[midd])
print "[Command]Kick executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
elif msg.text in ["Bot Kill Ban","Bot kill ban"]:
if msg.toType == 2:
if msg.from_ in admin:
group = cl.getGroup(msg.to)
gMembMids = [contact.mid for contact in group.members]
matched_list = []
if matched_list != []:
cl.sendText(msg.to,"Blacklisted contact noticed...")
cl.sendText(msg.to,"Begin Kicking contact")
for tag in wait["blacklist"]:
matched_list+=filter(lambda str: str == tag, gMembMids)
if matched_list == []:
cl.sendText(msg.to,"It looks empty here.")
return
for jj in matched_list:
random.choice(KAC).kickoutFromGroup(msg.to,[jj])
print "[Command]Kill ban executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
#-----------------------[Send Profile Section]------------------------
elif msg.text in ["Show bot all","Show bot all"]:
msg.contentType = 13
msg.contentMetadata = {'mid': mid}
cl.sendMessage(msg)
msg.contentMetadata = {'mid': Amid}
kk.sendMessage(msg)
msg.contentMetadata = {'mid': Bmid}
ki.sendMessage(msg)
msg.contentMetadata = {'mid': Cmid}
kc.sendMessage(msg)
print "[Command]Bot all executed"
elif msg.text in ["Bot 1","bot 1"]:
msg.contentType = 13
msg.contentMetadata = {'mid': mid}
cl.sendMessage(msg)
print "[Command]Bot 1 executed"
elif msg.text in ["Bot 2","bot 2"]:
msg.contentType = 13
msg.contentMetadata = {'mid': Amid}
kk.sendMessage(msg)
print "[Command]Bot 2 executed"
elif msg.text in ["Bot 3","bot 3"]:
msg.contentType = 13
msg.contentMetadata = {'mid': Bmid}
ki.sendMessage(msg)
print "[Command]Bot 3 executed"
elif msg.text in ["Bot 4","bot 4"]:
msg.contentType = 13
msg.contentMetadata = {'mid': Cmid}
kc.sendMessage(msg)
print "[Command]Bot 4 executed"
#-----------------------[Cancel invitation Section]------------------------
elif msg.text in ["cancel inv","Cancel Inv","Cancel inv"]:
if msg.toType == 2:
X = cl.getGroup(msg.to)
cl.sendText(msg.to,"Canceling all pending(s) invitation")
if X.invitee is not None:
gInviMids = [contact.mid for contact in X.invitee]
cl.cancelGroupInvitation(msg.to, gInviMids)
print "[Command]Cancel executed"
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"This group doesn't have any pending invitation")
print "[Command]Group don't have pending invitation"
else:
cl.sendText(msg.to,"Sorry, nobody absent")
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"Can not be used outside the group")
print "Cancel executed outside group chat"
else:
cl.sendText(msg.to,"Not for use less than group")
#-----------------------[Group link Section]------------------------
elif msg.text in ["Glink off","Link off","glink off","link off","Link Off"]:
if msg.toType == 2:
if msg.from_ in staff:
X = cl.getGroup(msg.to)
X.preventJoinByTicket = True
cl.updateGroup(X)
if wait["lang"] == "JP":
cl.sendText(msg.to,"Invitation link turned off")
print "[Command]Glink off executed"
else:
cl.sendText(msg.to,"Already turned off")
print "[Command]Glink off executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Staff or higher permission required.")
print "[Error]Command denied - staff or higher permission required"
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"Can not be used outside the group")
print "[Command]Glink off executed outside group chat"
else:
cl.sendText(msg.to,"Not for use less than group")
elif msg.text in ["Glink on","Link on","glink on","link on","Link On"]:
if msg.toType == 2:
if msg.from_ in staff:
X = cl.getGroup(msg.to)
X.preventJoinByTicket = False
cl.updateGroup(X)
if wait["lang"] == "JP":
cl.sendText(msg.to,"Invitation link turned on")
print "[Command]Glink on executed"
else:
cl.sendText(msg.to,"Already turned on")
print "[Command]Glink on executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Staff or higher permission required.")
print "[Error]Command denied - staff or higher permission required"
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"Can not be used outside the group")
print "[Command]Glink on executed outside group chat"
else:
cl.sendText(msg.to,"Not for use less than group")
#-----------------------[Group info Section]------------------------
elif msg.text in ["Show Ginfo","Show ginfo"]:
if msg.toType == 2:
ginfo = cl.getGroup(msg.to)
try:
gCreator = ginfo.creator.displayName
except:
gCreator = "Error"
if wait["lang"] == "JP":
if ginfo.invitee is None:
sinvitee = "0"
else:
sinvitee = str(len(ginfo.invitee))
if ginfo.preventJoinByTicket == True:
u = "close"
else:
u = "open"
random.choice(KAC).sendText(msg.to,"[Group Name]\n" + str(ginfo.name) + "\n\n[Group ID]\n" + msg.to + "\n\n[Group Creator]\n" + gCreator + "\n\n[Group Status]\nGroup Picture:\nhttp://dl.profile.line.naver.jp/" + ginfo.pictureStatus + "\n\nMembers:" + str(len(ginfo.members)) + "\nPending:" + sinvitee)
print "[Command]Ginfo executed"
else:
random.choice(KAC).sendText(msg.to,"[Group Name]\n" + str(ginfo.name) + "\n\n[Group ID]\n" + msg.to + "\n\n[Group Creator]\n" + gCreator + "\n\n[Group Status]\nGroup Picture:\nhttp://dl.profile.line.naver.jp/" + ginfo.pictureStatus)
print "[Command]Ginfo executed"
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"Can not be used outside the group")
print "[Command]Ginfo executed outside group chat"
else:
cl.sendText(msg.to,"Not for use less than group")
#-----------------------[Bot/User/Group ID Section]------------------------
elif msg.text in ["Show Gid","Show gid"]:
cl.sendText(msg.to,msg.to)
print "[Command]Gid executed"
elif msg.text in ["Show Mid All","Show mid all"]:
cl.sendText(msg.to,"[Ardh-]Bot(s) ID\n[Ardh-]BOT1\n" + mid + "\n\n[Ardh-]BOT2\n" + Amid + "\n\n[Ardh-]BOT3\n" + Bmid + "\n\n[Ardh-]BOT4\n" + Cmid + "\n\n[Ardh-]BOT5\n" + Dmid)
print "[Command]Mid executed"
elif msg.text in ["Bot Mid 1","Bot mid 1"]:
cl.sendText(msg.to,mid)
print "[Command]Mid 1 executed"
elif msg.text in ["Bot Mid 2","Bot mid 2"]:
kk.sendText(msg.to,Amid)
print "[Command]Mid 2 executed"
elif msg.text in ["Bot Mid 3","Bot mid 3"]:
ki.sendText(msg.to,Bmid)
print "[Command]Mid 3 executed"
elif msg.text in ["Bot Mid 4","Bot mid 4"]:
kc.sendText(msg.to,Cmid)
print "[Command]Mid 4 executed"
elif msg.text in ["Bot id","bot id"]:
cl.sendText(msg.to,msg.from_)
print "[Command]Yid executed"
#-----------------------[Send Contact Section]------------------------
elif "Gh Contact" in msg.text:
mmid = msg.text.replace("Gh Contact ","")
msg.contentType = 13
msg.contentMetadata = {"mid":AdminMID}
cl.sendMessage(msg)
print "[Command]Contact executed"
elif "Gh contact" in msg.text:
mmid = msg.text.replace("Gh contact ","")
msg.contentType = 13
msg.contentMetadata = {"mid":AdminMID}
cl.sendMessage(msg)
print "[Command]Contact executed"
#-----------------------[Auto Join Section]------------------------
elif msg.text in ["Gh Join On","Gh join on"]:
if wait["autoJoin"] == True:
if wait["lang"] == "JP":
cl.sendText(msg.to,"Auto join already on")
print "[Command]Join on executed"
else:
cl.sendText(msg.to,"Auto join already on")
print "[Command]Join on executed"
else:
wait["autoJoin"] = True
if wait["lang"] == "JP":
cl.sendText(msg.to,"Auto join turned on")
print "[Command]Join on executed"
else:
cl.sendText(msg.to,"Auto join turned on")
print "Join on executed"
elif msg.text in ["Gh Join Off","Gh join off"]:
if wait["autoJoin"] == False:
if wait["lang"] == "JP":
cl.sendText(msg.to,"Auto join already off")
print "[Command]Join off executed"
else:
cl.sendText(msg.to,"Auto join already off")
print "[Command]Join off executed"
else:
wait["autoJoin"] = False
if wait["lang"] == "JP":
cl.sendText(msg.to,"Auto join turned off")
print "[Command]Join off executed"
else:
cl.sendText(msg.to,"Auto join turned off")
print "[Command]Join off executed"
#-----------------------[Group Url Section]------------------------
elif msg.text in ["Gh Gurl","Gh gurl"]:
if msg.toType == 2:
if msg.from_ in admin:
x = cl.getGroup(msg.to)
if x.preventJoinByTicket == True:
x.preventJoinByTicket = False
cl.updateGroup(x)
gurl = cl.reissueGroupTicket(msg.to)
cl.sendText(msg.to,"line://ti/g/" + gurl)
print "[Command]Gurl executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"Can't be used outside the group")
print "[Command]Gurl executed outside group chat"
else:
cl.sendText(msg.to,"Not for use less than group")
#-----------------------[All bots join group Section]------------------------
elif msg.text in ["Bot Join","Bot join"]:
if msg.from_ in admin:
try:
ginfo = cl.getGroup(msg.to)
ginfo.preventJoinByTicket = False
cl.updateGroup(ginfo)
Ticket = cl.reissueGroupTicket(msg.to)
ki.acceptGroupInvitationByTicket(msg.to,Ticket)
kk.acceptGroupInvitationByTicket(msg.to,Ticket)
kc.acceptGroupInvitationByTicket(msg.to,Ticket)
ginfo = random.choice(KAC).getGroup(msg.to)
ginfo.preventJoinByTicket = True
random.choice(KAC).updateGroup(ginfo)
except:
print "Somethings wrong with the url"
print "[Command]Join all executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
#-----------------------[Bot(s) Leave Section]------------------------
elif msg.text in ["@Bye all","@bye all"]:
if msg.toType == 2:
if msg.from_ in admin:
ginfo = cl.getGroup(msg.to)
try:
cl.leaveGroup(msg.to)
kk.leaveGroup(msg.to)
ki.leaveGroup(msg.to)
kc.leaveGroup(msg.to)
except:
pass
print "[Command]Bye all executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
elif msg.text in ["@Bye bot 1","@bye bot 1"]:
if msg.toType == 2:
if msg.from_ in admin:
ginfo = cl.getGroup(msg.to)
try:
cl.leaveGroup(msg.to)
except:
pass
print "[Command]Bye bot 1 executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
elif msg.text in ["@Bye bot 2","@bye bot 2"]:
if msg.toType == 2:
if msg.from_ in admin:
ginfo = kk.getGroup(msg.to)
try:
kk.leaveGroup(msg.to)
except:
pass
print "[Command]Bye bot 2 executed"
else:
kk.sendText(msg.to,"Command denied.")
kk.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
elif msg.text in ["@Bye bot 3","@bye bot 3"]:
if msg.toType == 2:
if msg.from_ in admin:
ginfo = ki.getGroup(msg.to)
try:
ki.leaveGroup(msg.to)
except:
pass
print "[Command]Bye bot 3 executed"
else:
ki.sendText(msg.to,"Command denied.")
ki.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
elif msg.text in ["@Bye bot 4","@bye bot 4"]:
if msg.toType == 2:
if msg.from_ in admin:
ginfo = kc.getGroup(msg.to)
try:
kc.leaveGroup(msg.to)
except:
pass
print "[Command]Bye bot 4 executed"
else:
kc.sendText(msg.to,"Command denied.")
kc.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
#-----------------------[Cleanse Section (USE AT YOUR OWN RISK!)]------------------------
elif msg.text in ["Clear Group","Clear group"]:
if msg.toType == 2:
if msg.from_ in admin:
print "[Command]Cleanse executing"
_name = msg.text.replace("Cleanse","")
gs = ki.getGroup(msg.to)
gs = kk.getGroup(msg.to)
gs = kc.getGroup(msg.to)
kk.sendText(msg.to,"Group cleansing begin")
kc.sendText(msg.to,"Goodbye :)")
targets = []
for g in gs.members:
if _name in g.displayName:
targets.append(g.mid)
# --------------[Bot and Admin MID]----------------
targets.remove(adminMID)
targets.remove(mid)
targets.remove(Amid)
targets.remove(Bmid)
targets.remove(Cmid)
# --------------[Bot and Admin MID]----------------
if targets == []:
ki.sendText(msg.to,"Not found.")
else:
for target in targets:
try:
klist=[ki,kk,kc,cl]
kicker=random.choice(klist)
kicker.kickoutFromGroup(msg.to,[target])
print (msg.to,[g.mid])
except:
ki.sendText(msg.to,"Group cleansed")
print "[Command]Cleanse executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
#-----------------------[Ban/Unban Section]------------------------
elif "Ban @" in msg.text:
if msg.toType == 2:
if msg.from_ in admin:
print "[Command]Ban executed"
_name = msg.text.replace("Gh Ban @","")
_nametarget = _name.rstrip(' ')
gs = ki.getGroup(msg.to)
gs = kk.getGroup(msg.to)
gs = kc.getGroup(msg.to)
targets = []
for g in gs.members:
if _nametarget == g.displayName:
targets.append(g.mid)
if targets == []:
ki.sendText(msg.to,"Contact not found")
else:
for target in targets:
try:
wait["blacklist"][target] = True
f=codecs.open('st2__b.json','w','utf-8')
json.dump(wait["blacklist"], f, sort_keys=True, indent=4,ensure_ascii=False)
cl.sendText(msg.to,"Added to Blacklist")
except:
ki.sendText(msg.to,"Error")
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Admin permission required.")
elif "Unban @" in msg.text:
if msg.toType == 2:
if msg.from_ in admin:
print "[Command]Unban executed"
_name = msg.text.replace("Gh Unban @","")
_nametarget = _name.rstrip(' ')
gs = ki.getGroup(msg.to)
gs = kk.getGroup(msg.to)
gs = kc.getGroup(msg.to)
targets = []
for g in gs.members:
if _nametarget == g.displayName:
targets.append(g.mid)
if targets == []:
ki.sendText(msg.to,"Contact not found")
else:
for target in targets:
try:
del wait["blacklist"][target]
f=codecs.open('st2__b.json','w','utf-8')
json.dump(wait["blacklist"], f, sort_keys=True, indent=4,ensure_ascii=False)
cl.sendText(msg.to,"Added to Whitelist")
except:
ki.sendText(msg.to,"Added to Whitelist")
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Admin permission required.")
elif msg.text in ["Ban","ban"]:
if msg.from_ in admin:
wait["wblacklist"] = True
cl.sendText(msg.to,"Send Contact to Ban")
print "[Command]Ban executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
elif msg.text in ["Unban","unban"]:
if msg.from_ in admin:
wait["dblacklist"] = True
cl.sendText(msg.to,"Send Contact to Unban")
print "[Command]Unban executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Admin permission required.")
print "[Error]Command denied - Admin permission required"
elif msg.text in ["Banlist","banlist"]:
if wait["blacklist"] == {}:
cl.sendText(msg.to,"No user is Blacklisted")
else:
cl.sendText(msg.to,"Blacklisted user(s)")
mc = ""
for mi_d in wait["blacklist"]:
mc += "->" +cl.getContact(mi_d).displayName + "\n"
cl.sendText(msg.to,mc)
print "[Command]Banlist executed"
#-----------------------[Bot Speak Section]------------------------
elif "Bc " in msg.text:
if msg.from_ in staff:
bctxt = msg.text.replace("Bc ","")
random.choice(KAC).sendText(msg.to,(bctxt))
print "[Command]Bc executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Staff or higher permission required.")
print "[Error]Command denied - staff or higher permission required"
elif "bc " in msg.text:
if msg.from_ in staff:
bctxt = msg.text.replace("bc ","")
cl.sendText(msg.to,(bctxt))
print "[Command]Bc executed"
else:
cl.sendText(msg.to,"Command denied.")
cl.sendText(msg.to,"Staff or higher permission required.")
print "[Error]Command denied - staff or higher permission required"