zoukankan      html  css  js  c++  java
  • Python_20行代码实现微信消息防撤回(简易版)

    学习了一下如何用python实现微信消息的防撤回,

    主要思路就是:

    • 时时监控微信,将对方发送的消息缓存下来
    • 如果对方撤回了消息,就将该缓存信息发送给文件传输助手

    但其实这功能,基本上毫无意义,看到别人错发的消息除了满足一下猎奇心,而且还是短暂的猎奇心,真的没什么卵用,除非你有其他目的。学习这个也基本上是浪费时间。

    所以我也只是把最常见的文字类消息实现了一下防撤回,其余的类型基本如法炮制即可。

    代码如下:

     1 import itchat
     2 from itchat.content import TEXT, NOTE
     3 
     4 
     5 itchat.auto_login(hotReload=True)
     6 
     7 types = None
     8 info = None
     9 name = None
    10 
    11 
    12 @itchat.msg_register([TEXT])
    13 def receive_info(msg):
    14     global types
    15     global info
    16     global name
    17     name = msg['FileName']
    18     types = msg["Type"]
    19     info = msg["Text"]
    20 
    21 
    22 @itchat.msg_register(NOTE)
    23 def withdraw_info(withdraw_msg):
    24     if "撤回了一条消息" in withdraw_msg["Text"]:
    25         if types == "Text":
    26             itchat.send(msg=withdraw_msg["Text"] +
    27                         ':' + info, toUserName="filehelper")
    28 
    29 
    30 itchat.run()
  • 相关阅读:
    03:矩形分割 (二分)
    09:膨胀的木棍 (二分+角度计算)
    A Cubic number and A Cubic Number (二分) HDU
    B
    08:不重复地输出数 (set)
    10:河中跳房子 (二分)
    07:和为给定数 (二分)
    04:网线主管 (二分)
    河中跳房子
    010:输出前k大的数
  • 原文地址:https://www.cnblogs.com/waterr/p/14105352.html
Copyright © 2011-2022 走看看