本帖最后由 zxszx4 于 2017-5-26 18:32 编辑
我看了下帖子,之后自己测试,想到可以用小冰公众号实现调用小冰的接口,自己写了下不太成功,就搜了下,发现了这篇文章
http://yangchy.com/2017/05/02/itchat/
这文章没有给出完整代码,我给你一个import itchat
itchat.auto_login(enableCmdQR=True)
xiaoice = itchat.search_mps(name='小冰')[0]['UserName']
who_send = None
@itchat.msg_register(itchat.content.TEXT)
def fw_ice(msg):
msg_text = msg['Text']
global who_send
who_send = msg['FromUserName']
itchat.send(msg_text, xiaoice)
@itchat.msg_register(itchat.content.TEXT, isMpChat=True)
def get_ice(msg):
ice_msg = msg['Text']
global who_send
itchat.send(ice_msg, toUserName=who_send)
itchat.run()
我对他的源代码做了修改,你自己试试哈 |