import itchat
from itchat.content import *
#引入正则模块
import re
#监听,谁给我发消息
@itchat.msg_register(INCOME_MSG)
def text_reply(msg):
#打印获取到的信息
print(msg)
#使用正则匹配带年字的信息
match = re.search('年', msg['Text'])
if match:
itchat.send("也祝你新年快乐!",toUserName=msg['FromUserName'])
itchat.auto_login(enableCmdQR=True,hotReload=True)
itchat.run()
使用itchat模块实现微信自动回复
最新推荐文章于 2024-04-14 01:40:58 发布