forked from merkremont/LineVodka
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathme.py
More file actions
369 lines (342 loc) · 15 KB
/
Copy pathme.py
File metadata and controls
369 lines (342 loc) · 15 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
# -*- coding: utf-8 -*-
from LineAlpha import LineClient
from LineAlpha.LineApi import LineTracer
from LineAlpha.LineThrift.ttypes import Message
from LineAlpha.LineThrift.TalkService import Client
import time, datetime, random ,sys, re, string, os, json
reload(sys)
sys.setdefaultencoding('utf-8')
client = LineClient()
client._qrLogin("line://au/q/")
profile, setting, tracer = client.getProfile(), client.getSettings(), LineTracer(client)
offbot, messageReq, wordsArray, waitingAnswer = [], {}, {}, {}
print client._loginresult()
admin=["uaeb63e0ae0c44a241e7ad71c4bb76f75"]
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":"Chivas ",
"blacklist":{},
"wblacklist":False,
"dblacklist":False,
"protectionOn":True,
"atjointicket":False
}
wait = {
'readPoint':{},
'readMember':{},
'setTime':{},
'ROM':{}
}
setTime = {}
setTime = wait["setTime"]
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
client._client.sendMessage(messageReq[to], mes)
def NOTIFIED_ADD_CONTACT(op):
try:
sendMessage(op.param1, client.getContact(op.param1).displayName + " Ciyee ngelock nih yee")
except Exception as e:
print e
print ("\n\nNOTIFIED_ADD_CONTACT\n\n")
return
tracer.addOpInterrupt(5,NOTIFIED_ADD_CONTACT)
def NOTIFIED_ACCEPT_GROUP_INVITATION(op):
#print op
try:
sendMessage(op.param1, client.getContact(op.param2).displayName + " Kam ")
except Exception as e:
print e
print ("\n\nNOTIFIED_ACCEPT_GROUP_INVITATION\n\n")
return
tracer.addOpInterrupt(17,NOTIFIED_ACCEPT_GROUP_INVITATION)
def NOTIFIED_KICKOUT_FROM_GROUP(op):
try:
sendMessage(op.param1, client.getContact(op.param3).displayName + " Mampus lu kena kick")
except Exception as e:
print e
print ("\n\nNOTIFIED_KICKOUT_FROM_GROUP\n\n")
return
tracer.addOpInterrupt(19,NOTIFIED_KICKOUT_FROM_GROUP)
def NOTIFIED_LEAVE_GROUP(op):
try:
sendMessage(op.param1, client.getContact(op.param2).displayName + " idih baper langsung leave")
except Exception as e:
print e
print ("\n\nNOTIFIED_LEAVE_GROUP\n\n")
return
tracer.addOpInterrupt(15,NOTIFIED_LEAVE_GROUP)
def NOTIFIED_READ_MESSAGE(op):
#print op
try:
if op.param1 in wait['readPoint']:
Name = client.getContact(op.param2).displayName
if Name in wait['readMember'][op.param1]:
pass
else:
wait['readMember'][op.param1] += "\n・" + Name
wait['ROM'][op.param1][op.param2] = "・" + Name
else:
pass
except:
pass
tracer.addOpInterrupt(55, NOTIFIED_READ_MESSAGE)
def RECEIVE_MESSAGE(op):
msg = op.message
try:
if msg.contentType == 0:
try:
if msg.to in wait['readPoint']:
if msg.from_ in wait["ROM"][msg.to]:
del wait["ROM"][msg.to][msg.from_]
else:
pass
except:
pass
else:
pass
except KeyboardInterrupt:
sys.exit(0)
except Exception as error:
print error
print ("\n\nRECEIVE_MESSAGE\n\n")
return
tracer.addOpInterrupt(26, RECEIVE_MESSAGE)
def SEND_MESSAGE(op):
msg = op.message
try:
if msg.toType == 0:
if msg.contentType == 0:
if msg.text == "mid":
sendMessage(msg.to, msg.to)
if msg.text == "me":
sendMessage(msg.to, text=None, contentMetadata={'mid': msg.from_}, contentType=13)
if msg.text == "gift":
sendMessage(msg.to, text="gift sent", contentMetadata=None, contentType=9)
else:
pass
else:
pass
if msg.toType == 2:
if msg.contentType == 0:
if msg.text == "Gift":
sendMessage(msg.to, text="gift sent", contentMetadata={'prdid': 'a0768339-c2d3-4189-9653-2909e9bb6f58',
'prdtype': 'theme',
'msgtpl': '5'}, contentType=9)
else:
pass
else:
pass
if msg.toType == 2:
if msg.contentType == 0:
if msg.text == "mid":
sendMessage(msg.to, msg.from_)
if msg.text == "gid":
sendMessage(msg.to, msg.to)
if msg.text == "ginfo":
group = client.getGroup(msg.to)
md = "[Group Name]\n" + group.name + "\n\n[gid]\n" + group.id + "\n\n[Group Picture]\nhttp://dl.profile.line-cdn.net/" + group.pictureStatus
if group.preventJoinByTicket is False: md += "\n\nInvitationURL: Permitted\n"
else: md += "\n\nInvitationURL: Refusing\n"
if group.invitee is None: md += "\nMembers: " + str(len(group.members)) + "人\n\nInviting: 0People"
else: md += "\nMembers: " + str(len(group.members)) + "People\nInvited: " + str(len(group.invitee)) + "People"
sendMessage(msg.to,md)
if "gname:" in msg.text:
key = msg.text[22:]
group = client.getGroup(msg.to)
group.name = key
client.updateGroup(group)
sendMessage(msg.to,"Group Name"+key+"Canged to")
if msg.text == "url":
sendMessage(msg.to,"line://ti/g/" + client._client.reissueGroupTicket(msg.to))
if msg.text == "open":
group = client.getGroup(msg.to)
if group.preventJoinByTicket == False:
sendMessage(msg.to, "beres boss")
else:
group.preventJoinByTicket = False
client.updateGroup(group)
sendMessage(msg.to, "URL Open")
if msg.text == "close":
group = client.getGroup(msg.to)
if group.preventJoinByTicket == True:
sendMessage(msg.to, "beres boss")
else:
group.preventJoinByTicket = True
client.updateGroup(group)
sendMessage(msg.to, "Beres boss")
if "kick:" in msg.text:
key = msg.text[5:]
client.kickoutFromGroup(msg.to, [key])
contact = client.getContact(key)
sendMessage(msg.to, ""+contact.displayName+" semoga tenang di alam sana kawan")
if "kick:" in msg.text:
key = msg.text[3:]
group = client.getGroup(msg.to)
Names = [contact.displayName for contact in group.members]
Mids = [contact.mid for contact in group.members]
if key in Names:
kazu = Names.index(key)
sendMessage(msg.to, "This Is Me")
client.kickoutFromGroup(msg.to, [""+Mids[kazu]+""])
contact = client.getContact(Mids[kazu])
sendMessage(msg.to, ""+contact.displayName+" Fuck")
else:
sendMessage(msg.to, "This Is ♠Me")
if msg.text == "cancel":
group = client.getGroup(msg.to)
if group.invitee is None:
sendMessage(op.message.to, "Gak ada pendingan bro")
else:
gInviMids = [contact.mid for contact in group.invitee]
client.cancelGroupInvitation(msg.to, gInviMids)
sendMessage(msg.to, str(len(group.invitee)) + " Beres")
if "invite:" in msg.text:
key = msg.text[-33:]
client.findAndAddContactsByMid(key)
client.inviteIntoGroup(msg.to, [key])
contact = client.getContact(key)
sendMessage(msg.to, ""+contact.displayName+" itu temenku ijin inpit")
if msg.text == "me":
M = Message()
M.to = msg.to
M.contentType = 13
M.contentMetadata = {'mid': msg.from_}
client.sendMessage(M)
if "show:" in msg.text:
key = msg.text[-33:]
sendMessage(msg.to, text=None, contentMetadata={'mid': key}, contentType=13)
contact = client.getContact(key)
sendMessage(msg.to, ""+contact.displayName+"'s contact")
if msg.text == "time":
sendMessage(msg.to, "hari ini " + datetime.datetime.today().strftime('%d-%m-%Y %H:%M:%S') + " WIB")
if msg.text == "gift":
sendMessage(msg.to, text="gift sent", contentMetadata=None, contentType=9)
if msg.text == "set":
sendMessage(msg.to, "Wait, gw cek yang sider")
try:
del wait['readPoint'][msg.to]
del wait['readMember'][msg.to]
except:
pass
wait['readPoint'][msg.to] = msg.id
wait['readMember'][msg.to] = ""
wait['setTime'][msg.to] = datetime.datetime.today().strftime('%Y-%m-%d %H:%M:%S')
wait['ROM'][msg.to] = {}
print wait
if msg.text == "cek sider":
if msg.to in wait['readPoint']:
if wait["ROM"][msg.to].items() == []:
chiya = ""
else:
chiya = ""
for rom in wait["ROM"][msg.to].items():
print rom
chiya += rom[1] + "\n"
sendMessage(msg.to, "Noh yang sider hajar dah %s\n\nList jones seumur hidup\n%sMoga bintitan tuh mata\n\nWaktu & Tanggal:\n[%s]" % (wait['readMember'][msg.to],chiya,setTime[msg.to]))
else:
sendMessage(msg.to, "gak usah lebay uwes, gae dolanan ae masane")
#-------------------------------------------------------------
if msg.text == "Speed":
start = time.time()
sendMessage(msg.to, "test speed")
elapsed_time = time.time() - start
sendMessage(msg.to, "%sseconds" % (elapsed_time))
#-------------------------------------------------------------
#-------------------------------------------------------------
if msg.text == "speed":
start = time.time()
sendMessage(msg.to, "test speed")
elapsed_time = time.time() - start
sendMessage(msg.to, "%sseconds" % (elapsed_time))
#-------------------------------------------------------------
if msg.text == "Misi":
print "ok"
_name = msg.text.replace("Mulai","")
gs = client.getGroup(msg.to)
sendMessage(msg.to,"Cuman Test Limit kok")
targets = []
for g in gs.members:
if _name in g.displayName:
targets.append(g.mid)
if targets == []:
sendMessage(msg.to,"error")
else:
for target in targets:
try:
klist=[client]
kicker=random.choice(klist)
kicker.kickoutFromGroup(msg.to,[target])
print (msg.to,[g.mid])
except:
sendText(msg.to,"error")
#-------------------------------------------------------------
#--------------------------------------------------------------
if msg.text == "~ THIS IS TDR FAMS ~":
print "ok"
_name = msg.text.replace("~ THIS IS TDR FAMS ~","")
gs = client.getGroup(msg.to)
sendMessage(msg.to,"Test Limit")
targets = []
for g in gs.members:
if _name in g.displayName:
targets.append(g.mid)
if targets == []:
sendMessage(msg.to,"error")
else:
for target in targets:
try:
klist=[client]
kicker=random.choice(klist)
kicker.kickoutFromGroup(msg.to,[target])
print (msg.to,[g.mid])
except:
sendText(msg.to,"error")
#-------------------------------------------------------------
elif msg.text in ["自動å‚åŠ :オン","Join on","Auto join:on","自動åƒåŠ ï¼šé–‹"]:
if wait["autoJoin"] == True:
if wait["lang"] == "JP":
cl.sendText(msg.to,"already on")
else:
cl.sendText(msg.to,"done")
else:
wait["autoJoin"] = True
if wait["lang"] == "JP":
cl.sendText(msg.to,"already on")
else:
cl.sendText(msg.to,"done")
elif msg.text in ["自動å‚åŠ :オフ","Join off","Auto join:off","自動åƒåŠ ï¼šé—œ"]:
if wait["autoJoin"] == False:
if wait["lang"] == "JP":
cl.sendText(msg.to,"already off")
else:
cl.sendText(msg.to,"done")
else:
pass
else:
pass
except Exception as e:
print e
print ("\n\nSEND_MESSAGE\n\n")
return
tracer.addOpInterrupt(25,SEND_MESSAGE)
while True:
tracer.execute()