"红包来了,红包来了"用了抢红包神器之后,我再也没有漏过一个红包拉~(功能逆天,春节必备)
'''
Function:
微信红包提示
'''
import itchat
import pygame
'''提示'''
def alarm():
pygame.mixer.init()
pygame.mixer.music.load('alarm.mp3')
pygame.mixer.music.play()
# try:
# import tkinter.messagebox
# tkinter.messagebox.showinfo('抢红包啦!', '有人发红包了, 快去抢啊!')
# except:
# pass
'''监控是否有红包-群聊(Note参数: 通知消息类型)'''
@itchat.msg_register('Note', isGroupChat=True)
def getNoteGroup(msg):
if u'收到红包' in msg['Text']:
print('[INFO]: %s' % msg['Text'])
alarm()
'''监控是否有红包-个人(Note参数: 通知消息类型)'''
@itchat.msg_register('Note', isGroupChat=False)
def getNote(msg):
if u'收到红包' in msg['Text']:
print('[INFO]: %s' % msg['Text'])
alarm()
if __name__ == '__main__':
itchat.auto_login(hotReload=True)
itchat.run()
itchat.logout()
源码及声音下载
{cloud title="红包来啦" type="lz" url="https://wwet.lanzouw.com/iynBl11bs1fi" password=""/}
标签:__,红包,itchat,Python,抢红包,Note,pygame,msg From: https://www.cnblogs.com/IvanKK/p/17712716.html