import itchat
from itchat.content import TEXT
import numpy as np
nameList = []allName = ['a','b','c'] #这里写上全员(备注名的)名单
@itchat.msg_register(TEXT, isGroupChat=True) #这里的TEXT表示如果有人发送文本消息,那么就会调用下面的方法
def simple_reply(msg):
rooms = itchat.search_chatrooms(name='群名')#找到群名
if len(rooms)!=0:
name = msg['ActualNickName'] message = msg['Content'] dic = ['打卡','已打'] #是否打卡,或其他想要捕获监控的关键字
for i in range(len(dic)):
if dic[i] in message:
print('--------------------------------------')
print(name)
print(message)
if name not in nameList:
nameList.append(name)
print('今日已打卡同学: ')
print(nameList)
allName.remove(name)
print('今日还未打卡同学:')
print(allName)
break
itchat.auto_login(hotReload = True) #hotReload = True 不用重复扫描二维码
itchat.run()