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.2.tar.gz (32.8 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.2-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

Details for the file vchat-1.0.2.tar.gz.

File metadata

  • Download URL: vchat-1.0.2.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for vchat-1.0.2.tar.gz
Algorithm Hash digest
SHA256 277e56cd0e2ac8e2ff9ffce4ef73c1aca97131e60fb9d23243163743761c6797
MD5 9b386c2068e99da4d7e1a0970a337a40
BLAKE2b-256 93f5838b330984735c5b34a6c203c2033b04975b704f2c53b07b996a2c2e0676

See more details on using hashes here.

File details

Details for the file VChat-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: VChat-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 40.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for VChat-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9f183d9e01e19265d112c6e2a84f3192d2833094132a426f9bc3cf25bf812345
MD5 d3a326fa5d96dd2d332647af939b8c02
BLAKE2b-256 dc47f192503226e69a1cb24b014ec82392f692920a96ee6050fc419a669e8409

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