import itchat
import requests
key='8edce3ce905a4c1dbb965e6b35c3834d'
def get_response(msg):
apiUrl='http://www.tuling123.com/openapi/api'
data={
'key':key,
'info':msg,
'userid':'wetchat',
}
try:
r=requests.post(apiUrl,data=data).json()
return r.get('text')
except:
return
@itchat.msg_register(itchat.content.TEXT)
def tuling_reply(msg):
Replay=u"我已经收到"+msg["Text"]
reply=get_response(msg["Text"])
if reply:
return reply
else:
return Replay
itchat.auto_login(hotReload=True)
itchat.run()
网友评论