在互联网飞速发展的下、民众的需求下,已经进入全民微信时代。村口的张大妈,家里的老父亲都知道怎么使用微信。
但是当我们与朋友,亲人,爱人聊天的时候,我估计每个人都经历过,那就是微信撤回功能中所提到的,对方撤回一条消息。
一条撤回的消息,就像一个秘密,让你迫切地想去一探究竟;或如一个诱饵,瞬间勾起你强烈的兴趣。你想知道,那是怎样的一句话?是对方不慎讲出的真话,还是一句发错了对象的话?
Python查看微信撤回消息参考代码:
mport re
import time
import itchat
from itchat.content import *
def text_reply(msg):
print(msg['Text'])
def text_reply(msg):
if msg['Type'] == 'Text':
reply_content = msg['Text']
elif msg['Type'] == 'Picture':
reply_content = r"图片: " + msg['FileName']
elif msg['Type'] == 'Card':
reply_content = r" " + msg['RecommendInfo']['NickName'] + r" 的名片"
elif msg['Type'] == 'Map':
x, y, location = re.search("<location x="(.*?)" y="(.*?)".*label="(.*?)".*", msg['OriContent']).group(1,
2,
3)
if location is None:
reply_content = r"位置: 纬度->" + x.__str__() + " 经度->" + y.__str__()
else:
reply_content = r"位置: " + location
elif msg['Type'] == 'Note':
reply_content = r"通知"
elif msg['Type'] == 'Sharing':
reply_content = r"分享"
elif msg['Type'] == 'Recording':
reply_content = r"语音"
elif msg['Type'] == 'Attachment':
reply_content = r"文件: " + msg['FileName']
elif msg['Type'] == 'Video':
reply_content = r"视频: " + msg['FileName']
else:
reply_content = r"消息"
friend = itchat.search_friends(userName=msg['FromUserName'])
itchat.send(r"Friend:%s -- %s "
r"Time:%s "
r" Message:%s" % (friend['NickName'], friend['RemarkName'], time.ctime(), reply_content),
toUserName='filehelper')
itchat.send(r"我已经收到你在【%s】发送的消息【%s】稍后回复。--微信助手(Python版)" % (time.ctime(), reply_content),
toUserName=msg['FromUserName'])
itchat.auto_login()
itchat.run()
PS:欢迎在留言区留下你的观点,一起讨论提高。如果今天的文章让你有新的启发,欢迎转发分享给更多人。
Python读者交流群已成立
公众号运营至今,离不开小伙伴们的支持。为了给小伙伴们提供一个互相交流的平台,特地开通了官方交流群。扫描下方二维码备注 进群 或者关注公众号 Python人工智能编程 后获取进群通道。
添加好友,备注【进群】
—————END—————
推荐阅读:
最近面试BAT,整理一份Python资料《Python学习手册》,覆盖了Python知识点、人工智能、深度学习、机器学习等方面。
获取方式:关注公众号并回复 Python 领取,更多内容陆续奉上。
觉得不错,点个“在看”然后转发出去
原创文章,作者:栈长,如若转载,请注明出处:https://www.cxyquan.com/12096.html