SoFunction
Updated on 2024-11-19

Python View WeChat Retracted Message Code

WeChat is a free application launched by Tencent on January 21, 2011 to provide instant messaging services for smart terminals, built by the product team of Tencent's Guangzhou R&D Center led by Bruce Zhang. Under the rapid development of the Internet and the demand of the public, WeChat has been updated to version 2.6.2.31, the era of universal WeChat. Auntie Zhang at the entrance of the village, the old father at home all know how to use WeChat.


The WeChat Withdraw Message feature was added in WeChat's 5.3.1.

If you need to withdraw a WeChat message, long press on the message you just sent, a menu will pop up with the option to withdraw. When you click on withdraw, you will see a prompt that the last WeChat message you just sent will be withdrawn. After clicking OK, you will see the message "You have withdrawn a message".

At the same time the message you just sent is deleted from the chat history. When you withdraw a WeChat message, the other party will receive an alert showing that you withdrew a message although they cannot see the message you sent.

When we chat with friends, relatives, loved ones, I guess everyone has manager, that is, the WeChat withdraw feature mentioned in the other party to withdraw a message.

As the saying goes, you can't take back what you've said, like water that's been poured out. But today you can, on WeChat and QQ, you can withdraw what you just said. When your cell phone beeps, it means you've received a message. You can't wait to open it and see who is talking to you again. Before you have time to read, or not yet finished reading, that sentence is suddenly gone, the screen shows "the other party withdrew a message". At this time, we all feel something

Every day, our cell phones receive a large number of messages, including what people say to you, the vast majority of which are dispensable words, that is, spam. You may be tired of this, but there is one message that can surely cause you concern, that is, "the other party withdrew a message".

A retracted message is like a secret that you are desperate to find out; or like a bait that instantly hooks you with a strong interest. You want to know, what kind of sentence is it? Is it the truth that the other person accidentally told, or is it a sentence sent to the wrong person?

Anyway, this retraction makes a sudden xxxxx. At this point, it's time for the techies to step in, and what kind of techies? As the title suggests: a Python programmer!

Python view source code for WeChat Withdraw Message:

mport re

import time

import itchat

from  import *

@itchat.msg_register([TEXT, PICTURE, MAP, CARD, NOTE, SHARING, RECORDING, ATTACHMENT, VIDEO])

def text_reply(msg):

 print(msg['Text'])

@itchat.msg_register([TEXT, PICTURE, MAP, CARD, NOTE, SHARING, RECORDING, ATTACHMENT, VIDEO])

@itchat.msg_register([TEXT, PICTURE, MAP, CARD, NOTE, SHARING, RECORDING, ATTACHMENT, VIDEO])

def text_reply(msg):

 if msg['Type'] == 'Text':

 reply_content = msg['Text']

 elif msg['Type'] == 'Picture':

 reply_content = r"Picture:" + msg['FileName']

 elif msg['Type'] == 'Card':

 reply_content = r" " + msg['RecommendInfo']['NickName'] + r"'s business card."

 elif msg['Type'] == 'Map':

 x, y, location = ("<location x=\"(.*?)\" y=\"(.*?)\".*label=\"(.*?)\".*",  msg['OriContent']).group(1,

2,

3)

 if location is None:

 reply_content = r"Location: latitude->" + x.__str__() + " Longitude->" + y.__str__()

 else:

 reply_content = r"Location: " + location

 elif msg['Type'] == 'Note':

 reply_content = r"Notification"

 elif msg['Type'] == 'Sharing':

 reply_content = r"Share."

 elif msg['Type'] == 'Recording':

 reply_content = r"Voice."

 elif msg['Type'] == 'Attachment':

 reply_content = r"Documentation:" + msg['FileName']

 elif msg['Type'] == 'Video':

 reply_content = r"Video:" + msg['FileName']

 else:

 reply_content = r"Message."

 friend = itchat.search_friends(userName=msg['FromUserName'])

 (r"Friend:%s -- %s "

 r"Time:%s "

 r" Message:%s" % (friend['NickName'], friend['RemarkName'], (),   reply_content),

 toUserName='filehelper')

(r"I've got you on the【%s】Sent messages【%s】reply later。--WeChat Assistant(Pythonblock of printing)" % ((), reply_content),

toUserName=msg['FromUserName'])

itchat.auto_login()

()

But here's a sincere advice, if you're a boyfriend or girlfriend, don't bother checking it out in Python, there are some things it's better not to know than to know. Personal experience, see you next time!