-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbot.py
More file actions
39 lines (31 loc) · 871 Bytes
/
bot.py
File metadata and controls
39 lines (31 loc) · 871 Bytes
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
from Linephu.linepy import *
from Linephu.akad.ttypes import *
client = LINE()
oepoll = OEPoll(client)
def SEND_MESSAGE(op):
msg = op.message
try:
if msg.toType == 2:
if msg.text.startswith("/invite "):
str1 = find_between_r(msg.text, "/invite ", "")
client.inviteIntoGroup(msg.to, [str1])
else:
pass
else:
pass
except Exception as error:
print(error)
print("\n\nSEND_MESSAGE\n\n")
return
oepoll.addOpInterruptWithDict({
OpType.SEND_MESSAGE: SEND_MESSAGE
})
def find_between_r(s, first, last):
try:
start = s.rindex(first) + len(first)
end = s.rindex(last, start)
return s[start:end]
except ValueError:
return ""
while True:
oepoll.trace()