用python写一个查看微信撤回消息的小功能
2018-03-01 18:24
1176 查看
import re import time import itchat from itchat.content 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"图片: " + 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()
相关文章推荐
- Python查看微信撤回消息代码
- 78行Python代码实现现微信撤回消息功能
- 微信smali反编译 查看撤回消息
- MessageDisplayKit 一个类似微信App的IM应用,拥有发送文字、图片、语音、视频、地理位置消息,管理本地通信录、分享朋友圈、漂流交友、摇一摇和更多有趣的功能。
- 基于Python实现通过微信搜索功能查看谁把你删除了
- 基于Python实现通过微信搜索功能查看谁把你删除了
- 使用Python微信库itchat获得好友和群组已撤回的消息
- python模仿网页版微信发送消息功能
- 使用Python制作自动推送微信消息提醒的备忘录功能
- 老司机带你攻破微信消息防撤回功能
- 老司机带你攻破微信消息防撤回功能 推荐
- python实现微信自动回复功能
- Android (ListActivity、Contextmenu)微信类消息置顶和删除和功能的实现
- 查看python 3中的内置函数列表,以及函数功能描述
- 0.1.4.3版脚本工具界面中增加了一个变量查看功能
- 看别人代码的时候有时候查看个关键字,但是liteide没有整个项目搜索的功能,就自己随便写了一个.
- python3 web更新和web查看日志的功能
- Python3 声明一个类,实现某些功能(例子)
- 基于swoole、redis做一个消息通知功能