Skip to content

Instantly share code, notes, and snippets.

@ibotdotout
Created July 29, 2015 17:58
Show Gist options
  • Save ibotdotout/382369f272b9a2804318 to your computer and use it in GitHub Desktop.
Save ibotdotout/382369f272b9a2804318 to your computer and use it in GitHub Desktop.
# original: https://github.com/carpedm20/LINE/blob/master/examples/echobot.py
from line import LineClient, LineGroup, LineContact
try:
client = LineClient("ID", "PASSWORD")
print client.authToken #print authToken before error and use this login again
#client = LineClient(authToken="AUTHTOKEN")
except:
print "Login Failed"
while True:
op_list = []
for op in client.longPoll():
op_list.append(op)
for op in op_list:
sender = op[0]
receiver = op[1]
message = op[2]
msg = message.text
#receiver.sendMessage("[%s] %s" % (sender.name, msg)) #this send message to ourselft that make infinity loop
sender.sendMessage("[%s] %s" % (sender.name, msg)) #send message back to sender
@tuyl
Copy link

tuyl commented Jun 27, 2017

picsart_06-23-09 53 04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment