Skip to main content

A wechat personal account interface

Project description

VChat - 基于itchat-uos完全重构的微信个人号接口

为什么使用VChat

  • 2024年确认可使用的少数微信个人帐号接口项目
  • 基于itchat-uos完全重构,type hint友好
  • 使用异步协程和结构化并发代替原itchat-uos的基于多线程的并发,性能更高,更容易集成到你的项目中
  • 不需要在2017年之前登录过微信网页端,不需要开通支付功能,新注册的微信号也能使用
  • 支持帐号多开

演示

demo1 demo1

快速开始

  1. 安装vchat(目前需要python版本3.10及以上)
    pip install vchat
    
  2. 新建文件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())
    
  3. 运行
    python main.py
    
  4. 终端中完成扫码
  5. enjoy

文档

已确认可以工作的功能

  1. 接受文本,图片,音频,视频,文件
  2. 发送文本,图片,视频,文件
  3. 收发好友消息和群聊消息

兼容性

因为使用了新的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

vchat-1.0.1.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

VChat-1.0.1-py3-none-any.whl (39.6 kB view details)

Uploaded Python 3

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

Hashes for vchat-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7b0fb4fec1ab42dab20906f8af560c638736ae410b2e5884240ba1aace1aa335
MD5 8b7073dcf78bc72cfef8879cbd7c84a5
BLAKE2b-256 9b548d3c34b599d1782641bf9daf133c49d7ce6fef6364426e52cc7007786429

See more details on using hashes here.

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

Hashes for VChat-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27dcccf98473d40e029c7bea9b00c261e466e6c295757ad80ddb1b71c349ee02
MD5 3932a7be4c86ec030eec30631b4e7240
BLAKE2b-256 e0988229265be0d0b35809807840a63347f9e8b0f53c7e8ab83823b21803e180

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page