-
Notifications
You must be signed in to change notification settings - Fork 9
/
self.py
1226 lines (1180 loc) · 56.2 KB
/
self.py
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 LineAlpha
from LineAlpha.lib.Gen.ttypes import Message
from datetime import datetime
from io import StringIO
import time,random,sys,json,codecs,threading,glob
cl = LineAlpha.LINE()
cl.login(qr=True)
cl.loginResult()
ki = LineAlpha.LINE()
ki.login(qr=True)
ki.loginResult()
ki2 = LineAlpha.LINE()
ki2.login(qr=True)
ki2.loginResult()
print u"login success"
reload(sys)
sys.setdefaultencoding('utf-8')
helpMessage ="""
🍒🍁°Qυєєи тαкєѕнιє°🍁🍒
🍒[Id]:
🍒[Mid]:
🍒[Me]:
🍒[Group Id]:
🍒[TL : "Text"]:
🍒[Share: on]:
🍒[Share: off]:
🍒[Rename :]:
🍒[Up clock]:
🍒[Name :]:
🍒[MIC]: ↪"mid"]:
🍒[Reject]: ↪" invite"]:
🍒[Contact: on]:
🍒[Contact: off]:
🍒[Auto join: on]:
🍒[Auto join: off]:
🍒[Auto leave: on]:
🍒[Auto leave: off]:
🍒[Invite cancel :]:
🍒[Auto add: on]:
🍒[Auto add: off]:
🍒[Massage add: "text"]:
🍒[Add confirmasi]:
🍒[Comment: on]:
🍒[Comment: off]:
🍒[Comment set : "Text"]:
🍒[Comment change :"Text"]:
🍒[Comment check]:
🍒[Clock: on]:
🍒[Clock: off]:
🍒[Setting]:
🍒🍒 Commands in the groups🍒🍒
🍒[Responsename/kicker]:
🍒[Ban]:
🍒[Unban]:
🍒[Banlist]:
🍒[Urlon]:
🍒[Urloff]:
🍒[Url]:
🍒[Ginfo]:
🍒[Invite: "mid"]:
🍒[Say: "Text"]:
🍒[Kick " @tag]:
🍒[Cancel]:
🍒[Gn: "name"]:
🍒[Purge: " Name"]:
🍒[NK: "Name"]:
🍒[Dead]:
🍒[Kicker request author]
🍒Selfbot by Queen🍒"""
mid = cl.getProfile().mid
kimid = ki.getProfile().mid
k2mid = ki2.getProfile().mid
wait = {
'contact':True,
'autoJoin':False,
'autoCancel':{"on":True,"members":1},
'leaveRoom':False,
'timeline':True,
'autoAdd':False,
'message':"",
"lang":"JP",
"comment":"花音family",
"commentOn":True,
"commentBlack":{},
"wblack":False,
"dblack":False,
"clock":True,
"cName":"Queen",
"blacklist":{},
"wblacklist":False,
"dblacklist":False
}
def bot(op):
try:
if op.type == 0:
return
if op.type == 5:
if wait["autoAdd"] == True:
cl.findAndAddContactsByMid(op.param1)
if (wait["message"] in [""," ","\n",None]):
pass
else:
cl.sendText(op.param1,str(wait["message"]))
if op.type == 13:
if mid in op.param3:
G = cl.getGroup(op.param1)
if wait["autoJoin"] == True:
if wait["autoCancel"]["on"] == True:
if len(G.members) <= wait["autoCancel"]["members"]:
cl.rejectGroupInvitation(op.param1)
else:
cl.acceptGroupInvitation(op.param1)
else:
cl.acceptGroupInvitation(op.param1)
elif wait["autoCancel"]["on"] == True:
if len(G.members) <= wait["autoCancel"]["members"]:
cl.rejectGroupInvitation(op.param1)
else:
Inviter = op.param3.replace("",',')
InviterX = Inviter.split(",")
matched_list = []
for tag in wait["blacklist"]:
matched_list+=filter(lambda str: str == tag, InviterX)
if matched_list == []:
pass
else:
cl.cancelGroupInvitation(op.param1, matched_list)
if op.type == 19:
if mid in op.param3:
wait["blacklist"][op.param2] = True
if op.type == 22:
if wait["leaveRoom"] == True:
cl.leaveRoom(op.param1)
if op.type == 24:
if wait["leaveRoom"] == True:
cl.leaveRoom(op.param1)
if op.type == 26:
msg = op.message
if msg.toType == 0:
msg.to = msg.from_
if msg.from_ == "u0c8779ca416157866099d62a8b583706":
if "join:" in msg.text:
list_ = msg.text.split(":")
try:
cl.acceptGroupInvitationByTicket(list_[1],list_[2])
G = cl.getGroup(list_[1])
G.preventJoinByTicket = True
cl.updateGroup(G)
except:
cl.sendText(msg.to,"error")
if msg.toType == 1:
if wait["leaveRoom"] == True:
cl.leaveRoom(msg.to)
if msg.contentType == 16:
url = msg.contentMetadata["postEndUrl"]
cl.like(url[25:58], url[66:], likeType=1001)
if op.type == 25:
msg = op.message
if msg.contentType == 13:
if wait["wblack"] == True:
if msg.contentMetadata["mid"] in wait["commentBlack"]:
cl.sendText(msg.to,"すでにブラックリストに入っています。")
wait["wblack"] = False
else:
wait["commentBlack"][msg.contentMetadata["mid"]] = True
wait["wblack"] = False
cl.sendText(msg.to,"コメントしないようにしました。")
f=codecs.open('st2.json','w','utf-8')
json.dump(wait["commentBlack"], f, sort_keys=True, indent=4,ensure_ascii=False)
elif wait["dblack"] == True:
if msg.contentMetadata["mid"] in wait["commentBlack"]:
del wait["commentBlack"][msg.contentMetadata["mid"]]
cl.sendText(msg.to,"ブラックリストから削除しました。")
wait["dblack"] = False
f=codecs.open('st2.json','w','utf-8')
json.dump(wait["commentBlack"], f, sort_keys=True, indent=4,ensure_ascii=False)
else:
wait["dblack"] = False
cl.sendText(msg.to,"ブラックリストに入っていません。")
elif wait["wblacklist"] == True:
if msg.contentMetadata["mid"] in wait["blacklist"]:
cl.sendText(msg.to,"すでにブラックリストに入っています。")
wait["wblacklist"] = False
else:
wait["blacklist"][msg.contentMetadata["mid"]] = True
wait["wblacklist"] = False
cl.sendText(msg.to,"ブラックリストに追加しました。")
f=codecs.open('st2__b.json','w','utf-8')
json.dump(wait["blacklist"], f, sort_keys=True, indent=4,ensure_ascii=False)
elif wait["dblacklist"] == True:
if msg.contentMetadata["mid"] in wait["blacklist"]:
del wait["blacklist"][msg.contentMetadata["mid"]]
cl.sendText(msg.to,"ブラックリストから削除しました。")
wait["dblacklist"] = False
f=codecs.open('st2__b.json','w','utf-8')
json.dump(wait["blacklist"], f, sort_keys=True, indent=4,ensure_ascii=False)
else:
wait["dblacklist"] = False
cl.sendText(msg.to,"ブラックリストに入っていません。")
elif wait["contact"] == True:
msg.contentType = 0
cl.sendText(msg.to,msg.contentMetadata["mid"])
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,"[displayName]:\n" + msg.contentMetadata["displayName"] + "\n[mid]:\n" + msg.contentMetadata["mid"] + "\n[statusMessage]:\n" + contact.statusMessage + "\n[pictureStatus]:\nhttp://dl.profile.line-cdn.net/" + contact.pictureStatus + "\n[coverURL]:\n" + str(cu))
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[mid]:\n" + msg.contentMetadata["mid"] + "\n[statusMessage]:\n" + contact.statusMessage + "\n[pictureStatus]:\nhttp://dl.profile.line-cdn.net/" + contact.pictureStatus + "\n[coverURL]:\n" + str(cu))
elif msg.contentType == 16:
if wait["timeline"] == True:
msg.contentType = 0
if wait["lang"] == "JP":
msg.text = "URL\n" + msg.contentMetadata["postEndUrl"]
else:
msg.text = "URL→\n" + msg.contentMetadata["postEndUrl"]
cl.sendText(msg.to,msg.text)
elif msg.text is None:
return
elif msg.text in ["help","Help","へるぷ"]:
if wait["lang"] == "JP":
cl.sendText(msg.to,helpMessage)
else:
cl.sendText(msg.to,helpt)
elif ("Gn:" in msg.text):
if msg.toType == 2:
group = cl.getGroup(msg.to)
group.name = msg.text.replace("Gn:","")
ki.updateGroup(group)
else:
cl.sendText(msg.to,"グループ以外では使用できません。")
elif ("群組名字變更→" in msg.text):
if msg.toType == 2:
group = cl.getGroup(msg.to)
group.name = msg.text.replace("群組名字變更→","")
cl.updateGroup(group)
else:
cl.sendText(msg.to,"以小组以外不能使用")
elif "kick:" in msg.text:
midd = msg.text.replace("kick:","")
cl.kickoutFromGroup(msg.to,[midd])
elif "Invite:" in msg.text:
midd = msg.text.replace("Invite:","")
cl.findAndAddContactsByMid(midd)
cl.inviteIntoGroup(msg.to,[midd])
elif "Me" == msg.text:
msg.contentType = 13
msg.contentMetadata = {'mid': mid}
cl.sendMessage(msg)
elif msg.text in ["Gift","愛的禮物"]:
msg.contentType = 9
msg.contentMetadata={'PRDID': '3b92ccf5-54d3-4765-848f-c9ffdc1da020',
'PRDTYPE': 'THEME',
'MSGTPL': '5'}
msg.text = None
cl.sendMessage(msg)
elif msg.text in ["キャンセル","cancel","取消邀請"]:
if msg.toType == 2:
group = ki.getGroup(msg.to)
if group.invitee is not None:
gInviMids = [contact.mid for contact in group.invitee]
ki.cancelGroupInvitation(msg.to, gInviMids)
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"招待中の人はいません。")
else:
cl.sendText(msg.to,"邀请里面的人不在。")
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"グループ以外では使用できません。")
else:
cl.sendText(msg.to,"以小组以外不能使用")
elif msg.text in ["Cancel"]:
if msg.toType == 2:
group = cl.getGroup(msg.to)
if group.invitee is not None:
gInviMids = [contact.mid for contact in group.invitee]
cl.cancelGroupInvitation(msg.to, gInviMids)
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"招待中の人はいません。")
else:
cl.sendText(msg.to,"邀请里面的人不在。")
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"グループ以外では使用できません。")
else:
cl.sendText(msg.to,"以小组以外不能使用")
#elif "gurl" == msg.text:
#print cl.getGroup(msg.to)
##cl.sendMessage(msg)
elif msg.text in ["urlon"]:
if msg.toType == 2:
group = cl.getGroup(msg.to)
group.preventJoinByTicket = False
cl.updateGroup(group)
if wait["lang"] == "JP":
cl.sendText(msg.to,"urlを許可しました。")
else:
cl.sendText(msg.to,"准许了URL。")
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"グループ以外では使用できません。")
else:
cl.sendText(msg.to,"以小组以外不能使用")
elif msg.text in ["urloff"]:
if msg.toType == 2:
group = cl.getGroup(msg.to)
group.preventJoinByTicket = True
cl.updateGroup(group)
if wait["lang"] == "JP":
cl.sendText(msg.to,"urlを拒否しました。")
else:
cl.sendText(msg.to,"拒绝了URL。")
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"グループ以外では使用できません。")
else:
cl.sendText(msg.to,"以小组以外不能使用")
elif msg.text == "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 = "Refusal"
else:
u = "許可"
cl.sendText(msg.to,"[Group]\n" + str(ginfo.name) + "\n[gid]\n" + msg.to + "\n[Group Creator]\n" + gCreator + "\n[Profile Group]\nhttp://dl.profile.line.naver.jp/" + ginfo.pictureStatus + "\nmember:" + str(len(ginfo.members)) + "人\ninvite:" + sinvitee + "人\nRejectURL:" + u + "中です。")
else:
cl.sendText(msg.to,"[名字]\n" + str(ginfo.name) + "\n[gid]\n" + msg.to + "\n[小组的作成者]\n" + gCreator + "\n[小组图标]\nhttp://dl.profile.line.naver.jp/" + ginfo.pictureStatus)
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"グループ以外では使用できません。")
else:
cl.sendText(msg.to,"以小组以外不能使用")
elif "id" == msg.text:
cl.sendText(msg.to,msg.to)
elif "mid" == msg.text:
cl.sendText(msg.to,mid)
ki.sendText(msg.to,kimid)
ki2.sendText(msg.to,k2mid)
elif "り" == msg.text:
msg.contentType = 7
msg.text = None
msg.contentMetadata = {
"STKID": "12623182_",
"STKPKGID": "2",
}
cl.sendMessage(msg)
elif "ダメ" == msg.text:
msg.contentType = 7
msg.text = None
msg.contentMetadata = {
"STKID": "12623183_",
"STKPKGID": "2",
}
cl.sendMessage(msg)
elif "少女祈祷中" == msg.text:
msg.contentType = 7
msg.text = None
msg.contentMetadata = {
"STKID": "12623191_",
"STKPKGID": "2",
}
cl.sendMessage(msg)
elif "TL:" in msg.text:
tl_text = msg.text.replace("TL:","")
cl.sendText(msg.to,"line://home/post?userMid="+mid+"&postId="+cl.new_post(tl_text)["result"]["post"]["postInfo"]["postId"])
elif "cl名前変更:" in msg.text:
string = msg.text.replace("cl名前変更:","")
if len(string.decode('utf-8')) <= 20:
profile = cl.getProfile()
profile.displayName = string
cl.updateProfile(profile)
cl.sendText(msg.to,"名前を" + string + "に変更しました。")
elif "我的名字" in msg.text:
string = msg.text.replace("我的名字","")
if len(string.decode('utf-8')) <= 20:
profile = cl.getProfile()
profile.displayName = string
cl.updateProfile(profile)
cl.sendText(msg.to,"名前を" + string + "に変更しました。")
#---------------------------------------------------------
elif "ki名前変更:" in msg.text:
string = msg.text.replace("ki名前変更:","")
if len(string.decode('utf-8')) <= 20:
profile = ki.getProfile()
profile.displayName = string
ki.updateProfile(profile)
ki.sendText(msg.to,"名前を" + string + "に変更しました。")
#--------------------------------------------------------
elif "ki2名前変更:" in msg.text:
string = msg.text.replace("ki2名前変更:","")
if len(string.decode('utf-8')) <= 20:
profile = ki2.getProfile()
profile.displayName = string
ki2.updateProfile(profile)
ki2.sendText(msg.to,"名前を" + string + "に変更しました。")
#--------------------------------------------------------
elif "連絡先:" in msg.text:
mmid = msg.text.replace("連絡先:","")
msg.contentType = 13
msg.contentMetadata = {"mid":mmid}
cl.sendMessage(msg)
elif msg.text in ["Contact:on"]:
if wait["contact"] == True:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオンです。")
else:
cl.sendText(msg.to,"是已经开。")
else:
wait["contact"] = True
if wait["lang"] == "JP":
cl.sendText(msg.to,"オンにしました。")
else:
cl.sendText(msg.to,"要了开。")
elif msg.text in ["Contact:off"]:
if wait["contact"] == False:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオフです。")
else:
cl.sendText(msg.to,"是已经关断。")
else:
wait["contact"] = False
if wait["lang"] == "JP":
cl.sendText(msg.to,"オフにしました。")
else:
cl.sendText(msg.to,"要了关断。")
elif msg.text in ["Auto join:on"]:
if wait["autoJoin"] == True:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオンです。")
else:
cl.sendText(msg.to,"是已经开。")
else:
wait["autoJoin"] = True
if wait["lang"] == "JP":
cl.sendText(msg.to,"オンにしました。")
else:
cl.sendText(msg.to,"要了开。")
elif msg.text in ["Auto join:off"]:
if wait["autoJoin"] == False:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオフです。")
else:
cl.sendText(msg.to,"是已经关断。")
else:
wait["autoJoin"] = False
if wait["lang"] == "JP":
cl.sendText(msg.to,"オフにしました。")
else:
cl.sendText(msg.to,"要了关断。")
elif "invite cancel:" in msg.text:
try:
strnum = msg.text.replace("invite cancel:","")
if strnum == "オフ":
wait["autoCancel"]["on"] = False
if wait["lang"] == "JP":
cl.sendText(msg.to,"招待拒否をオフしました。\nオンにするときは人数を指定して送信して下さい。")
else:
cl.sendText(msg.to,"关了邀请拒绝。要时开请指定人数发送")
else:
num = int(strnum)
wait["autoCancel"]["on"] = True
if wait["lang"] == "JP":
cl.sendText(msg.to,strnum + "人以下のグループは自動で招待拒否するようにしました。")
else:
cl.sendText(msg.to,strnum + "使人以下的小组用自动邀请拒绝")
except:
if wait["lang"] == "JP":
cl.sendText(msg.to,"値が間違っています。")
else:
cl.sendText(msg.to,"价值奇怪。")
elif msg.text in ["Auto leave:on"]:
if wait["leaveRoom"] == True:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオンです。")
else:
cl.sendText(msg.to,"是已经开。")
else:
wait["leaveRoom"] = True
if wait["lang"] == "JP":
cl.sendText(msg.to,"オンにしました。")
else:
cl.sendText(msg.to,"要了开。")
elif msg.text in ["Auto leave:off"]:
if wait["leaveRoom"] == False:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオフです。")
else:
cl.sendText(msg.to,"是已经关断。")
else:
wait["leaveRoom"] = False
if wait["lang"] == "JP":
cl.sendText(msg.to,"オフにしました。")
else:
cl.sendText(msg.to,"要了关断。")
elif msg.text in ["Auto share:on"]:
if wait["timeline"] == True:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオンです。")
else:
cl.sendText(msg.to,"是已经开。")
else:
wait["timeline"] = True
if wait["lang"] == "JP":
cl.sendText(msg.to,"オンにしました。")
else:
cl.sendText(msg.to,"要了开。")
elif msg.text in ["Auto share:off"]:
if wait["timeline"] == False:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオフです。")
else:
cl.sendText(msg.to,"是已经关断。")
else:
wait["timeline"] = False
if wait["lang"] == "JP":
cl.sendText(msg.to,"オフにしました。")
else:
cl.sendText(msg.to,"要了关断。")
elif "Settings" == msg.text:
md = ""
if wait["contact"] == True: md+="Contact on\n"
else: md+="Contact off\n"
if wait["autoJoin"] == True: md+="Auto join on\n"
else: md +="Auto join off\n"
if wait["autoCancel"]["on"] == True:md+="Invite Cancel:" + str(wait["autoCancel"]["members"]) + "\n"
else: md+= "Invite cancel off\n"
if wait["leaveRoom"] == True: md+="Auto leave on\n"
else: md+="Auto leave off\n"
if wait["timeline"] == True: md+="Auto share on\n"
else:md+="Auto share off\n"
if wait["autoAdd"] == True: md+="Auto add on\n"
else:md+="Auto add off\n"
if wait["commentOn"] == True: md+="Comment on"
else:md+="Comment off"
cl.sendText(msg.to,md)
elif "アルバム取得:" in msg.text:
gid = msg.text.replace("アルバム取得:","")
album = cl.getAlbum(gid)
if album["result"]["items"] == []:
if wait["lang"] == "JP":
cl.sendText(msg.to,"アルバムはありません。")
else:
cl.sendText(msg.to,"相册没在。")
else:
if wait["lang"] == "JP":
mg = "以下が対象のアルバムです。"
else:
mg = "以下是对象的相册"
for y in album["result"]["items"]:
if "photoCount" in y:
mg += str(y["title"]) + ":" + str(y["photoCount"]) + "枚\n"
else:
mg += str(y["title"]) + ":0枚\n"
cl.sendText(msg.to,mg)
elif "相簿→" in msg.text:
gid = msg.text.replace("相簿→","")
album = cl.getAlbum(gid)
if album["result"]["items"] == []:
if wait["lang"] == "JP":
cl.sendText(msg.to,"アルバムはありません。")
else:
cl.sendText(msg.to,"相册没在。")
else:
if wait["lang"] == "JP":
mg = "以下が対象のアルバムです。"
else:
mg = "以下是对象的相册"
for y in album["result"]["items"]:
if "photoCount" in y:
mg += str(y["title"]) + ":" + str(y["photoCount"]) + "枚\n"
else:
mg += str(y["title"]) + ":0枚\n"
elif "相簿刪除→" in msg.text:
gid = msg.text.replace("相簿刪除→","")
albums = cl.getAlbum(gid)["result"]["items"]
i = 0
if albums != []:
for album in albums:
cl.deleteAlbum(gid,album["id"])
i += 1
if wait["lang"] == "JP":
cl.sendText(msg.to,str(i) + "件のアルバムを削除しました。")
else:
cl.sendText(msg.to,str(i) + "删除了事的相册。")
elif msg.text in ["Group id","群組全id"]:
gid = cl.getGroupIdsJoined()
g = ""
for i in gid:
g += "[%s]:%s\n" % (cl.getGroup(i).name,i)
cl.sendText(msg.to,g)
elif msg.text in ["全招待拒否"]:
gid = cl.getGroupIdsInvited()
for i in gid:
cl.rejectGroupInvitation(i)
if wait["lang"] == "JP":
cl.sendText(msg.to,"完了。")
else:
cl.sendText(msg.to,"拒绝了全部的邀请。")
elif "アルバム削除:" in msg.text:
gid = msg.text.replace("アルバム削除:","")
albums = cl.getAlbum(gid)["result"]["items"]
i = 0
if albums != []:
for album in albums:
cl.deleteAlbum(gid,album["id"])
i += 1
if wait["lang"] == "JP":
cl.sendText(msg.to,str(i) + "件のアルバムを削除しました。")
else:
cl.sendText(msg.to,str(i) + "删除了事的相册。")
elif msg.text in ["Auto add:on"]:
if wait["autoAdd"] == True:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオンです。")
else:
cl.sendText(msg.to,"是已经开。")
else:
wait["autoAdd"] = True
if wait["lang"] == "JP":
cl.sendText(msg.to,"オンにしました。")
else:
cl.sendText(msg.to,"要了开。")
elif msg.text in ["Auto add:off"]:
if wait["autoAdd"] == False:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオフです。")
else:
cl.sendText(msg.to,"是已经关断。")
else:
wait["autoAdd"] = False
if wait["lang"] == "JP":
cl.sendText(msg.to,"オフにしました。")
else:
cl.sendText(msg.to,"要了关断。")
elif "Massage add:" in msg.text:
wait["message"] = msg.text.replace("Massage add:","")
cl.sendText(msg.to,"メッセージを変更しました。")
elif "自動追加問候語變更→" in msg.text:
wait["message"] = msg.text.replace("自動追加問候語變更→","")
if wait["lang"] == "JP":
cl.sendText(msg.to,"メッセージを変更しました。")
else:
cl.sendText(msg.to,"变更了信息。")
elif msg.text in ["Add confirmasi","自動追加問候語確認"]:
if wait["lang"] == "JP":
cl.sendText(msg.to,"自動追加メッセージは以下のように設定されています。\n\n" + wait["message"])
else:
cl.sendText(msg.to,"自动追加信息像以下一样地被设定。\n\n" + wait["message"])
elif msg.text in ["言語変更","言語變更"]:
if wait["lang"] =="JP":
wait["lang"] = "TW"
cl.sendText(msg.to,"切換中國語。")
else:
wait["lang"] = "JP"
cl.sendText(msg.to,"言語を日本語にしました。")
elif "コメント変更→" in msg.text:
c = msg.text.replace("コメント変更→","")
if c in [""," ","\n",None]:
cl.sendText(msg.to,"変更できない文字列です。")
else:
wait["comment"] = c
cl.sendText(msg.to,"変更しました。\n\n" + c)
elif "Comment set:" in msg.text:
c = msg.text.replace("Comment set:","")
if c in [""," ","\n",None]:
cl.sendText(msg.to,"変更できない文字列です。")
else:
wait["comment"] = c
cl.sendText(msg.to,"変更しました。\n\n" + c)
elif msg.text in ["Comment:on","コメント:オン","コメント:on","自動首頁留言:開"]:
if wait["commentOn"] == True:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオンです。")
else:
cl.sendText(msg.to,"是已经开。")
else:
wait["commentOn"] = True
if wait["lang"] == "JP":
cl.sendText(msg.to,"オンにしました。")
else:
cl.sendText(msg.to,"要了开。")
elif msg.text in ["Comment:off","コメント:オフ","コメント:off","自動首頁留言:關"]:
if wait["commentOn"] == False:
if wait["lang"] == "JP":
cl.sendText(msg.to,"既にオフです。")
else:
cl.sendText(msg.to,"是已经关断。")
else:
wait["commentOn"] = False
if wait["lang"] == "JP":
cl.sendText(msg.to,"オフにしました。")
else:
cl.sendText(msg.to,"要了关断。")
elif msg.text in ["Comment check","留言確認"]:
cl.sendText(msg.to,"現在自動コメントは以下のように設定されています。\n\n" + str(wait["comment"]))
elif msg.text in ["url"]:
if msg.toType == 2:
g = cl.getGroup(msg.to)
if g.preventJoinByTicket == True:
g.preventJoinByTicket = False
cl.updateGroup(g)
gurl = cl.reissueGroupTicket(msg.to)
cl.sendText(msg.to,"line://ti/g/" + gurl)
else:
if wait["lang"] == "JP":
cl.sendText(msg.to,"グループ以外では使用できません。")
else:
cl.sendText(msg.to,"以小组以外不能使用")
elif "gurl:" in msg.text:
if msg.toType == 2:
gid = msg.text.replace("gurl:","")
gurl = cl.reissueGroupTicket(gid)
cl.sendText(msg.to,"line://ti/g/" + gurl)
else:
cl.sendText(msg.to,"グループ以外では使用できません。")
elif "aurl:" in msg.text:
if msg.toType == 1:
tid = msg.text.replace("aurl:","")
turl = ki.getUserTicket(tid)
ki.sendText(msg.to,"line://ti/p" + turl)
else:
ki.sendText(msg.to,"error")
elif "gurl得到→" in msg.text:
if msg.toType == 2:
gid = msg.text.replace("gurl得到→","")
gurl = cl.reissueGroupTicket(gid)
cl.sendText(msg.to,"line://ti/g/" + gurl)
else:
cl.sendText(msg.to,"以小组以外不能使用")
elif msg.text in ["cb"]:
wait["wblack"] = True
cl.sendText(msg.to,"ブラックリストに追加する人の連絡先を送信してください。")
elif msg.text in ["cbd"]:
wait["dblack"] = True
cl.sendText(msg.to,"ブラックリストから追加する人の連絡先を送信してください。")
elif msg.text in ["cbc"]:
if wait["commentBlack"] == {}:
cl.sendText(msg.to,"ブラックリストにしている人はいません。")
else:
cl.sendText(msg.to,"以下がブラックリストです。")
mc = ""
for mi_d in wait["commentBlack"]:
mc += "・" +cl.getContact(mi_d).displayName + "\n"
cl.sendText(msg.to,mc)
elif msg.text in ["Clock:on"]:
if wait["clock"] == True:
cl.sendText(msg.to,"既にオンです。")
else:
wait["clock"] = True
now2 = datetime.now()
nowT = datetime.strftime(now2,"(%H:%M)")
profile = cl.getProfile()
profile.displayName = wait["cName"] + nowT
cl.updateProfile(profile)
cl.sendText(msg.to,"オンにしました。")
elif msg.text in ["Clock:off"]:
if wait["clock"] == False:
cl.sendText(msg.to,"既にオフです。")
else:
wait["clock"] = False
cl.sendText(msg.to,"オフにしました。")
elif "Rename:" in msg.text:
n = msg.text.replace("Rename:","")
if len(n.decode("utf-8")) > 13:
cl.sendText(msg.to,"長すぎます。")
else:
wait["cName"] = n
cl.sendText(msg.to,"変更しました。\n\n" + n)
elif msg.text in ["Up clock"]:
if wait["clock"] == True:
now2 = datetime.now()
nowT = datetime.strftime(now2,"(%H:%M)")
profile = cl.getProfile()
profile.displayName = wait["cName"] + nowT
cl.updateProfile(profile)
cl.sendText(msg.to,"更新しました。")
else:
cl.sendText(msg.to,"名前時計をオンにしてください。")
elif "NK:" in msg.text:
if msg.toType == 2:
print "ok"
_name = msg.text.replace("NK:","")
gs = ki.getGroup(msg.to)
targets = []
for g in gs.members:
if _name in g.displayName:
targets.append(g.mid)
if targets == []:
ki.sendText(msg.to,"Not found.")
else:
for target in targets:
try:
klist=[ki,ki2]
kicker=random.choice(klist)
kicker.kickoutFromGroup(msg.to,[target])
print (msg.to,[g.mid])
except:
ki.sendText(msg.to,"Error")
#-----------------------------------------------------------
elif "Purge:" in msg.text:
if msg.toType == 2:
print "ok"
_name = msg.text.replace("Purge:","")
gs = cl.getGroup(msg.to)
targets = []
for g in gs.members:
if _name in g.displayName:
targets.append(g.mid)
if targets == []:
cl.sendText(msg.to,"Not found.")
else:
for target in targets:
try:
cl.kickoutFromGroup(msg.to,[target])
print (msg.to,[g.mid])
except:
pass
#-----------------------------------------------------------
elif "kick:@" in msg.text:
_name = msg.text.replace("kick:@","")
_kicktarget = _name.rstrip(' ')
gs = ki.getGroup(msg.to)
targets = []
for g in gs.members:
if _kicktarget == g.displayName:
targets.append(g.mid)
if targets == []:
cl.sendText(msg.to,"not found")
else:
for target in targets:
try:
klist=[cl,ki,ki2]
kicker=random.choice(klist)
kicker.kickoutFromGroup(msg.to,[target])
print (msg.to,[g.mid])
except:
ki.sendText(msg.to,"error")
#-----------------------------------------------------------
#statusMessage
elif "SK:" in msg.text:
if msg.toType == 2:
print "[SK]ok"
_name = msg.text.replace("SK:","")
gs = ki.getGroup(msg.to)
targets = []
for g in gs.members:
if _name in g.statusMessage:
targets.append(g.mid)
if targets == []:
ki.sendText(msg.to,"Not found.")
else:
for target in targets:
try:
klist=[ki,ki2,ki3,ki4,ki5,ki6,ki7,ki8,ki9,ki10,ki11,ki12,ki13]
kicker=random.choice(klist)
kicker.kickoutFromGroup(msg.to,[target])
print (msg.to,[g.mid])
except:
ki.sendText(msg.to,"Error")
#-----------------------------------------------------------
#-----------------------------------------------------------
elif "BAN:@" in msg.text:
_name = msg.text.replace("BAN:@","")
_kicktarget = _name.rstrip(' ')
gs = ki2.getGroup(msg.to)
targets = []
for g in gs.members:
if _kicktarget == g.displayName:
targets.append(g.mid)
if targets == []:
cl.sendText(msg.to,"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)
ki2.sendText(msg.to,"ヽ( ^ω^)ノ サクセス!")
except:
ki.sendText(msg.to,"error")
#-----------------------------------------------------------
elif "midb:" in msg.text:
midd = msg.text.replace("midb:","")
wait["blacklist"][midd] = True
f=codecs.open('st2__b.json','w','utf-8')
json.dump(wait["blacklist"], f, sort_keys=True, indent=4,ensure_ascii=False)
#-----------------------------------------------------------
elif "NB:" in msg.text:
if msg.toType == 2:
print "[NB]ok"
_name = msg.text.replace("NB:","")
gs = ki.getGroup(msg.to)
targets = []
for g in gs.members:
if _name in g.displayName:
targets.append(g.mid)
if targets == []:
ki.sendText(msg.to,"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)
except:
ki.sendText(msg.to,"Error")
#-----------------------------------------------------------
elif "#終了" in msg.text:
try:
import sys
sys.exit()
except:
pass
#-----------------------------------------------------------
#-----------------------------------------------------------
elif "Responsename" in msg.text:
ki.sendText(msg.to,"ki1")
ki2.sendText(msg.to,"ki2")
#-----------------------------------------------------------speed
elif msg.text in ["Ban"]:
wait["wblacklist"] = True
cl.sendText(msg.to,"ブラックリストに登録するアカウントを送信してください。")
elif msg.text in ["Unban"]:
wait["dblacklist"] = True
cl.sendText(msg.to,"ブラックリストから削除するアカウントを送信してください。")
elif msg.text in ["Banlist"]:
if wait["blacklist"] == {}:
cl.sendText(msg.to,"ブラックリストにしている人はいません。")
else:
cl.sendText(msg.to,"以下がブラックリストです。")
mc = ""
for mi_d in wait["blacklist"]:
mc += "・" +cl.getContact(mi_d).displayName + "\n"
cl.sendText(msg.to,mc)
elif msg.text in ["gbc"]:
if msg.toType == 2:
group = cl.getGroup(msg.to)
gMembMids = [contact.mid for contact in group.members]
matched_list = []
for tag in wait["blacklist"]:
matched_list+=filter(lambda str: str == tag, gMembMids)
cocoa = ""
for mm in matched_list:
cocoa += "・" +cl.getContact(mm).displayName + "\n"
cl.sendText(msg.to,cocoa + "がブラックリストです。")
elif msg.text in ["bk"]:
if msg.toType == 2:
group = ki.getGroup(msg.to)
gMembMids = [contact.mid for contact in group.members]
matched_list = []
for tag in wait["blacklist"]:
matched_list+=filter(lambda str: str == tag, gMembMids)
if matched_list == []:
ki.sendText(msg.to,"ブラックリストユーザーはいませんでした。")
return
for jj in matched_list:
try:
klist=[ki,ki2,ki3,ki4,ki5,ki6,ki7,ki8,ki9]
kicker=random.choice(klist)
kicker.kickoutFromGroup(msg.to,[jj])