A wechat personal account interface
Project description
VChat - 基于itchat-uos完全重构的微信个人号接口
为什么使用VChat
- 2024年确认可使用的少数微信个人帐号接口项目
- 基于itchat-uos完全重构,type hint友好
- 使用异步协程和结构化并发代替原itchat-uos的基于多线程的并发,性能更高,更容易集成到你的项目中
- 不需要在2017年之前登录过微信网页端,不需要开通支付功能,新注册的微信号也能使用
- 支持帐号多开
演示
快速开始
- 安装
vchat(目前需要python版本3.10及以上)pip install vchat
- 新建文件
main.py,内容如下import asyncio from vchat import Core from vchat.model import ContentTypes, ContactTypes core = Core() # 注册消息回调函数,收到感兴趣的消息后,VChat会调用这个函数 # 设置过滤器,只处理文本类型的消息,只接受群聊的消息 @core.msg_register(msg_types=ContentTypes.TEXT, contact_type=ContactTypes.CHATROOM) async def _(msg): print(msg.content.content) # 打印消息的内容 async def main(): await core.init() await core.auto_login(hot_reload=True) # 给文件传输助手发送hello, filehelper await core.send_msg("hello, filehelper", to_username="filehelper") # 启动VChat的消息接收循环 await core.run() if __name__ == "__main__": asyncio.run(main())
- 运行
python main.py - 终端中完成扫码
- enjoy
文档
已确认可以工作的功能
- 接受文本,图片,音频,视频,文件
- 发送文本,图片,视频,文件
- 收发好友消息和群聊消息
兼容性
因为使用了新的union语法,需要python3.10及以上版本,未来会去除这个限制
QA
-
VChat支持同步调用吗?
不支持,因为异步协程是更简单的并发模型,符合结构化并发,而且python的同步和异步差别很大,无法一份代码同时供同步异步调用 -
如何将VChat集成到我的项目中?
异步:使用TaskGroup等待core.run和你的异步主函数即可
同步:创建一个线程,使用asyncio.run运行vchat即可
免责声明
使用本项目默认用户已经阅读并知悉微信个人账号使用规范
推荐单独注册一个微信号,并严格限制其用途,严格遵守《计算机软件保护条例》(2013修订)第十七条规定,禁止商用
为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可
一切由于使用本项目造成的后果由使用者自行承担
如有侵权,请联系作者删除
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vchat-1.0.1.tar.gz.
File metadata
- Download URL: vchat-1.0.1.tar.gz
- Upload date:
- Size: 29.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b0fb4fec1ab42dab20906f8af560c638736ae410b2e5884240ba1aace1aa335
|
|
| MD5 |
8b7073dcf78bc72cfef8879cbd7c84a5
|
|
| BLAKE2b-256 |
9b548d3c34b599d1782641bf9daf133c49d7ce6fef6364426e52cc7007786429
|
File details
Details for the file VChat-1.0.1-py3-none-any.whl.
File metadata
- Download URL: VChat-1.0.1-py3-none-any.whl
- Upload date:
- Size: 39.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27dcccf98473d40e029c7bea9b00c261e466e6c295757ad80ddb1b71c349ee02
|
|
| MD5 |
3932a7be4c86ec030eec30631b4e7240
|
|
| BLAKE2b-256 |
e0988229265be0d0b35809807840a63347f9e8b0f53c7e8ab83823b21803e180
|