Skip to main content

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即可

重要

VChat是在MIT许可证下发行的自由软件,这意味着您可以在承认原作者(LittleCoder)的copyright的前提下以任何意图运行VChat、分发VChat的副本、修改VChat、重分发修改后的副本

使用VChat前,您应当知悉,VChat依赖于微信服务,这是一个商业的、专有的互联网服务,您无法在不使用微信服务的情况下使用VChat
因此,尽管原作者通过MIT协议授予您使用VChat的自由,但您如何使用微信服务仍然受微信个人账号使用规范,以及您所在地区或国家的法律法规所限制

作者遵循原itchat-uos的协议,不在MIT协议之上附加任何条款,也不限制您使用VChat的自由。作者开发并维护VChat的原因仅仅是学习itchat-uos内部的原理、在linux平台使用微信。您在使用VChat过程中产生的任何滥用行为所造成的后果由您承担

为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可

Metadata

Release files for VChat 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for VChat 1.2.0
File Size Uploaded
vchat-1.2.0.tar.gz 33.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for VChat 1.2.0
File Interpreter ABI Platform
VChat-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 74.5 kB

Release files / vchat-1.2.0.tar.gz

Download URL vchat-1.2.0.tar.gz
Size 33.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8ffc46197f947e0ec0c3bea88e02260124162ae190a6da17ed8bbd1120425bc2
BLAKE2b-256 checksum
How to use checksums
338ded97e588b23ab5dfdfe7a395ee49ce5c3f310f5f0e0e00950cdae31d5ddf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 15, 2024.

Transparency log

Release files / VChat-1.2.0-py3-none-any.whl

Download URL VChat-1.2.0-py3-none-any.whl
Size 41.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ac100221746f03ae04bd66e3b9bf1161cb0dfd14e80960db03ee2acd7241122
BLAKE2b-256 checksum
How to use checksums
acaffa01b407d172da5a498a25b7f362b43dceb9888da4cb3d112be8beb4da88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 15, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page