最近考试比较多,还有各种事情蜂拥而至,微信上消息不断,就想着搞一个微信自动回复出来,要求也不高,只是能自动回复就好了。
自动回复实现
调用的是itchat的包
import itchat
from itchat.content import TEXT
from itchat.content import *
import sys
import time
import re
import requests, json
import os
# When recieve the following msg types, trigger the auto replying.
@itchat.msg_register([TEXT, PICTURE, FRIENDS, CARD, MAP, SHARING, RECORDING, ATTACHMENT, VIDEO],isFriendChat=True, isMpChat=False)
def text_reply(msg):
global auto_reply, robort_reply, peer_list
if msg['FromUserName'] == myUserName and msg['Content'] == u"open":
auto_reply = True
itchat.send_msg(u"[自动回复]已经打开。\n", msg['FromUserName'])
elif msg['FromUserName'] == myUserName and msg['Content'] == u"close":
auto_reply = False
itchat.send_msg(u