需安装的库itchat,tkinter,winsound(一般自带)
itchat+apscheduler+xlrd读取excel自动定时发wechat
itchat.login()登录网页端wechat
itchat.getchatrooms()读取群列表
显示保存在通讯录的群列表方法:
mem=itchat.get_chatrooms(update=True)
for i in mem:
print(i[‘NickName’])
import itchat
# import tkinter.messagebox
def alarm():
# Windows嗡鸣声
import winsound
winsound.Beep(1000, 3000)
# tkinter.messagebox.showinfo('重要提醒','有人发红包啦!') #会阻塞
@itchat.msg_register('Note', isGroupChat=True)
def get_note(msg):
if '红包' in msg['Text']:
print('note:',msg['Text'])
alarm() # 自定义提醒
itchat.auto_login(hotReload=True)
itchat.run()
itchat.logout()