zoukankan      html  css  js  c++  java
  • 6.微信撤回消息的获取

    import itchat
    from itchat.content import *
    import re
    msg_infomation = {}
    @itchat.msg_register([TEXT])
    def handle_receive_msg(msg):
        msg_from = itchat.search_friends(userName=msg['FromUserName'])['NickName']
        msg_time = msg['CreateTime']
        msg_id = msg['MsgId']
        msg_content = msg['Text']
        msg_infomation.update(
            {
            msg_id:{
            'msg_from':msg_from,
            'msg_time':msg_time,
            'msg_content':msg_content
            }
            }
        )
    
    #监听撤回消息
    #@itchat.msg_register(NOTE,isFriendChat=True,isCroupChat=True,isMpChat=True)
    @itchat.msg_register([NOTE])
    def information(msg):
        if '撤回了一条消息' in msg['Content']:
            old_msg_id = re.search("<msgid>(.*?)</msgid>",msg['Content']).group()#<msgid>XXX<msgid>
            print('~~~~~~~~~~~~')
            print(msg_infomation.get(old_msg_id))
    
    #二维码微信登录
    itchat.auto_login(enableCmdQR=True,hotReload=True)
    itchat.run()
  • 相关阅读:
    软件评价——360安全卫士
    对于软件工程课程的疑问
    附加作业
    个人最终总结
    结对编程 电梯调度程序
    读程序作业
    VS2015 单元测试
    VS2015 的安装过程
    四则运算程序
    对于软件的点评
  • 原文地址:https://www.cnblogs.com/zhangboblogs/p/8634704.html
Copyright © 2011-2022 走看看