D-Bot/readmes/Telegram/Telegram.py
Denny Dai ad22866d0c Change lua to python.
easiler to use
2015-06-04 16:15:34 +08:00

11 lines
332 B
Python

#coding:utf-8
import tgl
import urllib
import urllib2
def on_msg_receive(msg):
params = urllib.urlencode({'from': msg.src.name.encode("UTF-8"), 'text': msg.text.encode("UTF-8"), 'to': msg.dest.name.encode("UTF-8")})
f = urllib.urlopen("[your BOT.php Url Here]?%s" % params)
print f.read()
tgl.set_on_msg_receive(on_msg_receive)