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

重要

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

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

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

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

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.1.0.tar.gz (33.5 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.1.0-py3-none-any.whl (41.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vchat-1.1.0.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for vchat-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ba8e121b09847acd4181acd8140d17c7ffd2195971728876662b556f742436af
MD5 a78b5610624cb0675c6a71c015a5a779
BLAKE2b-256 e1bb4131d646ed0dee971c130cc92d56250c1333639c410515457fe1b77f3db2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: VChat-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for VChat-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a18f3354cc7a507f918a275f026a8f7870a93cbd4b7027b31ec7660616d75619
MD5 b701a4f3c882382bcd841dfac2a702ee
BLAKE2b-256 1f5ce2e91356600a215fb4e5f4187303e3d86a3c1ce260a8d1915df751eae47e

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