-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathsb.py
170 lines (161 loc) · 8.53 KB
/
sb.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
# -*- coding: utf-8 -*-
from linepy import *
import json, time, random
client = LineClient()
#client = LineClient(authToken='AUTH TOKEN')
client.log("Auth Token : " + str(client.authToken))
channel = LineChannel(client)
client.log("Channel Access Token : " + str(channel.channelAccessToken))
poll = LinePoll(client)
cctv={
"cyduk":{},
"point":{},
"sidermem":{}
}
while True:
try:
ops=poll.singleTrace(count=50)
for op in ops:
if op.type == 26:
msg = op.message
if msg.text != None:
if msg.toType == 2:
may = client.getProfile().mid
if may in str(msg.contentMetadata) and 'MENTION' in str(msg.contentMetadata):
pilih = ['yang tag sy semoga jomblo seumur hidup','ngapain tag tag woe, kangen?','ada apa ini? ko di tag?','duhh kena tag, dianya kesepian kali yah','gk usah tag, gift tikel aja']
rslt = random.choice(pilih)
client.sendText(msg.to, str(rslt))
else:
pass
else:
pass
else:
pass
elif op.type == 25:
msg = op.message
text = msg.text
msg_id = msg.id
receiver = msg.to
sender = msg._from
try:
if msg.contentType == 0:
if msg.toType == 2:
client.sendChatChecked(receiver, msg_id)
contact = client.getContact(sender)
if text.lower() == 'me':
client.sendMessage(receiver, None, contentMetadata={'mid': sender}, contentType=13)
elif text.lower() == 'speed':
start = time.time()
client.sendText(receiver, "TestSpeed")
elapsed_time = time.time() - start
client.sendText(receiver, "%sdetik" % (elapsed_time))
elif 'spic' in text.lower():
try:
key = eval(msg.contentMetadata["MENTION"])
u = key["MENTIONEES"][0]["M"]
a = client.getContact(u).pictureStatus
client.sendImageWithURL(receiver, 'http://dl.profile.line.naver.jp/'+a)
except Exception as e:
client.sendText(receiver, str(e))
elif 'scover' in text.lower():
try:
key = eval(msg.contentMetadata["MENTION"])
u = key["MENTIONEES"][0]["M"]
a = channel.getProfileCoverURL(mid=u)
client.sendImageWithURL(receiver, a)
except Exception as e:
client.sendText(receiver, str(e))
elif text.lower() == 'tagall':
group = client.getGroup(msg.to)
nama = [contact.mid for contact in group.members]
nm1, nm2, nm3, nm4, nm5, jml = [], [], [], [], [], len(nama)
if jml <= 100:
client.mention(msg.to, nama)
if jml > 100 and jml < 200:
for i in range(0, 100):
nm1 += [nama[i]]
client.mention(msg.to, nm1)
for j in range(101, len(nama)):
nm2 += [nama[j]]
client.mention(msg.to, nm2)
if jml > 200 and jml < 300:
for i in range(0, 100):
nm1 += [nama[i]]
client.mention(msg.to, nm1)
for j in range(101, 200):
nm2 += [nama[j]]
client.mention(msg.to, nm2)
for k in range(201, len(nama)):
nm3 += [nama[k]]
client.mention(msg.to, nm3)
if jml > 300 and jml < 400:
for i in range(0, 100):
nm1 += [nama[i]]
client.mention(msg.to, nm1)
for j in range(101, 200):
nm2 += [nama[j]]
client.mention(msg.to, nm2)
for k in range(201, len(nama)):
nm3 += [nama[k]]
client.mention(msg.to, nm3)
for l in range(301, len(nama)):
nm4 += [nama[l]]
client.mention(msg.to, nm4)
if jml > 400 and jml < 501:
for i in range(0, 100):
nm1 += [nama[i]]
client.mention(msg.to, nm1)
for j in range(101, 200):
nm2 += [nama[j]]
client.mention(msg.to, nm2)
for k in range(201, len(nama)):
nm3 += [nama[k]]
client.mention(msg.to, nm3)
for l in range(301, len(nama)):
nm4 += [nama[l]]
client.mention(msg.to, nm4)
for m in range(401, len(nama)):
nm5 += [nama[m]]
client.mention(msg.to, nm5)
client.sendText(receiver, "Members :"+str(jml))
elif text.lower() == 'ceksider':
try:
del cctv['point'][msg.to]
del cctv['sidermem'][msg.to]
del cctv['cyduk'][msg.to]
except:
pass
cctv['point'][msg.to] = msg.id
cctv['sidermem'][msg.to] = ""
cctv['cyduk'][msg.to]=True
elif text.lower() == 'offread':
if msg.to in cctv['point']:
cctv['cyduk'][msg.to]=False
client.sendText(msg.to, cctv['sidermem'][msg.to])
else:
client.sendText(msg.to, "Heh belom di Set")
except Exception as e:
client.log("[SEND_MESSAGE] ERROR : " + str(e))
elif op.type == OpType.NOTIFIED_READ_MESSAGE:
try:
if cctv['cyduk'][op.param1]==True:
if op.param1 in cctv['point']:
Name = client.getContact(op.param2).displayName
if Name in cctv['sidermem'][op.param1]:
pass
else:
cctv['sidermem'][op.param1] += "\n~ " + Name
pref=['eh ada','hai kak','aloo..','nah','lg ngapain','halo','sini kak']
client.sendText(op.param1, str(random.choice(pref))+' '+Name)
else:
pass
else:
pass
except:
pass
else:
pass
# Don't remove this line, if you wan't get error soon!
poll.setRevision(op.revision)
except Exception as e:
client.log("[SINGLE_TRACE] ERROR : " + str(e))