- Notifications
You must be signed in to change notification settings - Fork851
Windows版本微信客户端(非网页版)自动化,可实现简单的发送、接收微信消息,简单微信机器人
License
NotificationsYou must be signed in to change notification settings
cluic/wxauto
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
文档:使用文档 |云服务器wxauto部署指南
环境 | 版本 |
---|---|
OS | |
微信 | |
Python |
fromwxautoimportWeChat# 初始化微信实例wx=WeChat()# 发送消息wx.SendMsg("你好",who="张三")# 获取当前聊天窗口消息msgs=wx.GetAllMessage()formsginmsgs:print(f"消息内容:{msg.content}, 消息类型:{msg.type}")
fromwxautoimportWeChatfromwxauto.msgsimportFriendMessageimporttimewx=WeChat()# 消息处理函数defon_message(msg,chat):text=f'[{msg.type}{msg.attr}]{chat} -{msg.content}'print(text)withopen('msgs.txt','a',encoding='utf-8')asf:f.write(text+'\n')ifmsg.typein ('image','video'):print(msg.download())ifisinstance(msg,FriendMessage):time.sleep(len(msg.content))msg.quote('收到') ...# 其他处理逻辑,配合Message类的各种方法,可以实现各种功能# 添加监听,监听到的消息用on_message函数进行处理wx.AddListenChat(nickname="张三",callback=on_message)# ... 程序运行一段时间后 ...# 移除监听wx.RemoveListenChat(nickname="张三")
如果对您有帮助,希望可以帮忙点个Star,如果您正在使用这个项目,可以将右上角的 Unwatch 点为 Watching,以便在我更新或修复某些 Bug 后即使收到反馈,感谢您的支持,非常感谢!
代码仅用于对UIAutomation技术的交流学习使用,禁止用于实际生产项目,请勿用于非法用途和商业用途!如因此产生任何法律纠纷,均与作者无关!
About
Windows版本微信客户端(非网页版)自动化,可实现简单的发送、接收微信消息,简单微信机器人
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.