Python实现微信自动回复机器人(简单)
安装环境:window7
安装wxpy:在cmd中输入以下命令
pip install -U wxpy
登录微信:在Python3.6.1中输入以下代码
from wxpy import * #导入模块
bot = Bot() #初始化机器人,扫码登录
将会出现一张二维码图片,然后显示登录成功
在下面输入以下代码实现与指定好友聊天:
myfriend = ensure_one(bot.search(u'好友名字'))#查找好友与其聊天
tuling = Tuling(api_key = '4a048cdce684468b95591a641f0971d')#调用图灵机器人
@bot.register(myfriend) #使用图灵机器人与其指定好友聊天
def reply_myfriend(msg):
tuling.do_reply(msg)
embed()