VChat


NameVChat JSON
Version 1.2.0 PyPI version JSON
download
home_pageNone
SummaryA wechat personal account interface
upload_time2024-12-15 05:05:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT License
keywords wechat wexin itchat itchat-uos
VCS
bugtrack_url
requirements pyqrcode aiohttp yarl lxml
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # VChat - 基于itchat-uos完全重构的微信个人号接口

# 为什么使用VChat

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

# 演示
<div style="display: flex;justify-content: space-around;width: 900px">
<img alt="demo1" style="width:400px" src="https://raw.githubusercontent.com/z2z63/image/main/202407302302972.png"/>
<img alt="demo1"  style="width:400px" src="https://raw.githubusercontent.com/z2z63/image/main/202407302305229.png"/>
</div>

# 快速开始
1. 安装`vchat`(目前需要python版本3.10及以上)
    ```shell
    pip install vchat
    ```
2. 新建文件`main.py`,内容如下
    ```python
    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. 运行
    ```shell
    python main.py
    ```
4. 终端中完成扫码
5. enjoy

# 文档
- [联系人(Contact)](./docs/model.md#联系人contact)
- [消息(Message)](./docs/model.md#消息message)
- [内容(Content)](./docs/model.md#内容content)
- [收发消息](./docs/send.md#收发消息)

已确认可以工作的功能

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的自由,但您如何使用微信服务仍然受[微信个人账号使用规范](https://weixin.qq.com/cgi-bin/readtemplate?&t=page/agreement/personal_account&lang=zh_CN),以及您所在地区或国家的法律法规所限制  

作者遵循原itchat-uos的协议,不在MIT协议之上附加任何条款,也不限制您使用VChat的自由。作者开发并维护VChat的原因仅仅是学习itchat-uos内部的原理、在linux平台使用微信。您在使用VChat过程中产生的任何滥用行为所造成的后果由您承担
> 为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "VChat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "wechat, wexin, itchat, itchat-uos",
    "author": null,
    "author_email": "z2z63 <vituralfuture@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/33/8d/ed97e588b23ab5dfdfe7a395ee49ce5c3f310f5f0e0e00950cdae31d5ddf/vchat-1.2.0.tar.gz",
    "platform": null,
    "description": "# VChat - \u57fa\u4e8eitchat-uos\u5b8c\u5168\u91cd\u6784\u7684\u5fae\u4fe1\u4e2a\u4eba\u53f7\u63a5\u53e3\n\n# \u4e3a\u4ec0\u4e48\u4f7f\u7528VChat\n\n- 2024\u5e74\u786e\u8ba4\u53ef\u4f7f\u7528\u7684\u5c11\u6570\u5fae\u4fe1\u4e2a\u4eba\u5e10\u53f7\u63a5\u53e3\u9879\u76ee\n- \u57fa\u4e8eitchat-uos\u5b8c\u5168\u91cd\u6784\uff0ctype hint\u53cb\u597d\n- \u4f7f\u7528\u5f02\u6b65\u534f\u7a0b\u548c\u7ed3\u6784\u5316\u5e76\u53d1\u4ee3\u66ff\u539fitchat-uos\u7684\u57fa\u4e8e\u591a\u7ebf\u7a0b\u7684\u5e76\u53d1\uff0c\u6027\u80fd\u66f4\u9ad8\uff0c\u66f4\u5bb9\u6613\u96c6\u6210\u5230\u4f60\u7684\u9879\u76ee\u4e2d\n- \u4e0d\u9700\u8981\u57282017\u5e74\u4e4b\u524d\u767b\u5f55\u8fc7\u5fae\u4fe1\u7f51\u9875\u7aef\uff0c\u4e0d\u9700\u8981\u5f00\u901a\u652f\u4ed8\u529f\u80fd\uff0c\u65b0\u6ce8\u518c\u7684\u5fae\u4fe1\u53f7\u4e5f\u80fd\u4f7f\u7528\n- \u652f\u6301\u5e10\u53f7\u591a\u5f00\n\n# \u6f14\u793a\n<div style=\"display: flex;justify-content: space-around;width: 900px\">\n<img alt=\"demo1\" style=\"width:400px\" src=\"https://raw.githubusercontent.com/z2z63/image/main/202407302302972.png\"/>\n<img alt=\"demo1\"  style=\"width:400px\" src=\"https://raw.githubusercontent.com/z2z63/image/main/202407302305229.png\"/>\n</div>\n\n# \u5feb\u901f\u5f00\u59cb\n1. \u5b89\u88c5`vchat`(\u76ee\u524d\u9700\u8981python\u7248\u672c3.10\u53ca\u4ee5\u4e0a)\n    ```shell\n    pip install vchat\n    ```\n2. \u65b0\u5efa\u6587\u4ef6`main.py`\uff0c\u5185\u5bb9\u5982\u4e0b\n    ```python\n    import asyncio\n    \n    from vchat import Core\n    from vchat.model import ContentTypes, ContactTypes\n    \n    core = Core()\n    # \u6ce8\u518c\u6d88\u606f\u56de\u8c03\u51fd\u6570\uff0c\u6536\u5230\u611f\u5174\u8da3\u7684\u6d88\u606f\u540e\uff0cVChat\u4f1a\u8c03\u7528\u8fd9\u4e2a\u51fd\u6570\n    # \u8bbe\u7f6e\u8fc7\u6ee4\u5668\uff0c\u53ea\u5904\u7406\u6587\u672c\u7c7b\u578b\u7684\u6d88\u606f\uff0c\u53ea\u63a5\u53d7\u7fa4\u804a\u7684\u6d88\u606f\n    @core.msg_register(msg_types=ContentTypes.TEXT, contact_type=ContactTypes.CHATROOM)\n    async def _(msg):\n       print(msg.content.content)  # \u6253\u5370\u6d88\u606f\u7684\u5185\u5bb9\n    \n    \n    async def main():\n       await core.init()\n       await core.auto_login(hot_reload=True)\n       # \u7ed9\u6587\u4ef6\u4f20\u8f93\u52a9\u624b\u53d1\u9001hello, filehelper\n       await core.send_msg(\"hello, filehelper\", to_username=\"filehelper\")\n       # \u542f\u52a8VChat\u7684\u6d88\u606f\u63a5\u6536\u5faa\u73af\n       await core.run()\n    \n    \n    if __name__ == \"__main__\":\n       asyncio.run(main())\n    ```\n3. \u8fd0\u884c\n    ```shell\n    python main.py\n    ```\n4. \u7ec8\u7aef\u4e2d\u5b8c\u6210\u626b\u7801\n5. enjoy\n\n# \u6587\u6863\n- [\u8054\u7cfb\u4eba(Contact)](./docs/model.md#\u8054\u7cfb\u4ebacontact)\n- [\u6d88\u606f(Message)](./docs/model.md#\u6d88\u606fmessage)\n- [\u5185\u5bb9(Content)](./docs/model.md#\u5185\u5bb9content)\n- [\u6536\u53d1\u6d88\u606f](./docs/send.md#\u6536\u53d1\u6d88\u606f)\n\n\u5df2\u786e\u8ba4\u53ef\u4ee5\u5de5\u4f5c\u7684\u529f\u80fd\n\n1. \u63a5\u53d7\u6587\u672c\uff0c\u56fe\u7247\uff0c\u97f3\u9891\uff0c\u89c6\u9891\uff0c\u6587\u4ef6\n2. \u53d1\u9001\u6587\u672c\uff0c\u56fe\u7247\uff0c\u89c6\u9891\uff0c\u6587\u4ef6\n3. \u6536\u53d1\u597d\u53cb\u6d88\u606f\u548c\u7fa4\u804a\u6d88\u606f\n\n## \u517c\u5bb9\u6027\n\u56e0\u4e3a\u4f7f\u7528\u4e86\u65b0\u7684union\u8bed\u6cd5\uff0c\u9700\u8981python3.10\u53ca\u4ee5\u4e0a\u7248\u672c\uff0c\u672a\u6765\u4f1a\u53bb\u9664\u8fd9\u4e2a\u9650\u5236\n## QA\n- VChat\u652f\u6301\u540c\u6b65\u8c03\u7528\u5417\uff1f  \n\u4e0d\u652f\u6301\uff0c\u56e0\u4e3a\u5f02\u6b65\u534f\u7a0b\u662f\u66f4\u7b80\u5355\u7684\u5e76\u53d1\u6a21\u578b\uff0c\u7b26\u5408\u7ed3\u6784\u5316\u5e76\u53d1\uff0c\u800c\u4e14python\u7684\u540c\u6b65\u548c\u5f02\u6b65\u5dee\u522b\u5f88\u5927\uff0c\u65e0\u6cd5\u4e00\u4efd\u4ee3\u7801\u540c\u65f6\u4f9b\u540c\u6b65\u5f02\u6b65\u8c03\u7528  \n\n- \u5982\u4f55\u5c06VChat\u96c6\u6210\u5230\u6211\u7684\u9879\u76ee\u4e2d\uff1f  \n\u5f02\u6b65\uff1a\u4f7f\u7528`TaskGroup`\u7b49\u5f85`core.run`\u548c\u4f60\u7684\u5f02\u6b65\u4e3b\u51fd\u6570\u5373\u53ef  \n\u540c\u6b65\uff1a\u521b\u5efa\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u4f7f\u7528`asyncio.run`\u8fd0\u884c`vchat`\u5373\u53ef  \n# \u91cd\u8981\nVChat\u662f\u5728MIT\u8bb8\u53ef\u8bc1\u4e0b\u53d1\u884c\u7684\u81ea\u7531\u8f6f\u4ef6\uff0c\u8fd9\u610f\u5473\u7740\u60a8\u53ef\u4ee5\u5728\u627f\u8ba4\u539f\u4f5c\u8005\uff08LittleCoder\uff09\u7684copyright\u7684\u524d\u63d0\u4e0b\u4ee5\u4efb\u4f55\u610f\u56fe\u8fd0\u884cVChat\u3001\u5206\u53d1VChat\u7684\u526f\u672c\u3001\u4fee\u6539VChat\u3001\u91cd\u5206\u53d1\u4fee\u6539\u540e\u7684\u526f\u672c\n\n\u4f7f\u7528VChat\u524d\uff0c\u60a8\u5e94\u5f53\u77e5\u6089\uff0cVChat\u4f9d\u8d56\u4e8e\u5fae\u4fe1\u670d\u52a1\uff0c\u8fd9\u662f\u4e00\u4e2a\u5546\u4e1a\u7684\u3001\u4e13\u6709\u7684\u4e92\u8054\u7f51\u670d\u52a1\uff0c\u60a8\u65e0\u6cd5\u5728\u4e0d\u4f7f\u7528\u5fae\u4fe1\u670d\u52a1\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528VChat  \n\u56e0\u6b64\uff0c\u5c3d\u7ba1\u539f\u4f5c\u8005\u901a\u8fc7MIT\u534f\u8bae\u6388\u4e88\u60a8\u4f7f\u7528VChat\u7684\u81ea\u7531\uff0c\u4f46\u60a8\u5982\u4f55\u4f7f\u7528\u5fae\u4fe1\u670d\u52a1\u4ecd\u7136\u53d7[\u5fae\u4fe1\u4e2a\u4eba\u8d26\u53f7\u4f7f\u7528\u89c4\u8303](https://weixin.qq.com/cgi-bin/readtemplate?&t=page/agreement/personal_account&lang=zh_CN)\uff0c\u4ee5\u53ca\u60a8\u6240\u5728\u5730\u533a\u6216\u56fd\u5bb6\u7684\u6cd5\u5f8b\u6cd5\u89c4\u6240\u9650\u5236  \n\n\u4f5c\u8005\u9075\u5faa\u539fitchat-uos\u7684\u534f\u8bae\uff0c\u4e0d\u5728MIT\u534f\u8bae\u4e4b\u4e0a\u9644\u52a0\u4efb\u4f55\u6761\u6b3e\uff0c\u4e5f\u4e0d\u9650\u5236\u60a8\u4f7f\u7528VChat\u7684\u81ea\u7531\u3002\u4f5c\u8005\u5f00\u53d1\u5e76\u7ef4\u62a4VChat\u7684\u539f\u56e0\u4ec5\u4ec5\u662f\u5b66\u4e60itchat-uos\u5185\u90e8\u7684\u539f\u7406\u3001\u5728linux\u5e73\u53f0\u4f7f\u7528\u5fae\u4fe1\u3002\u60a8\u5728\u4f7f\u7528VChat\u8fc7\u7a0b\u4e2d\u4ea7\u751f\u7684\u4efb\u4f55\u6ee5\u7528\u884c\u4e3a\u6240\u9020\u6210\u7684\u540e\u679c\u7531\u60a8\u627f\u62c5\n> \u4e3a\u4e86\u5b66\u4e60\u548c\u7814\u7a76\u8f6f\u4ef6\u5185\u542b\u7684\u8bbe\u8ba1\u601d\u60f3\u548c\u539f\u7406\uff0c\u901a\u8fc7\u5b89\u88c5\u3001\u663e\u793a\u3001\u4f20\u8f93\u6216\u8005\u5b58\u50a8\u8f6f\u4ef6\u7b49\u65b9\u5f0f\u4f7f\u7528\u8f6f\u4ef6\u7684\uff0c\u53ef\u4ee5\u4e0d\u7ecf\u8f6f\u4ef6\u8457\u4f5c\u6743\u4eba\u8bb8\u53ef\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A wechat personal account interface",
    "version": "1.2.0",
    "project_urls": {
        "Homepage": "https://github.com/z2z63/VChat",
        "Issues": "https://github.com/z2z63/VChat/issues"
    },
    "split_keywords": [
        "wechat",
        " wexin",
        " itchat",
        " itchat-uos"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "acaffa01b407d172da5a498a25b7f362b43dceb9888da4cb3d112be8beb4da88",
                "md5": "bff76a9f1822177f668e02248506b390",
                "sha256": "7ac100221746f03ae04bd66e3b9bf1161cb0dfd14e80960db03ee2acd7241122"
            },
            "downloads": -1,
            "filename": "VChat-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bff76a9f1822177f668e02248506b390",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 41112,
            "upload_time": "2024-12-15T05:05:23",
            "upload_time_iso_8601": "2024-12-15T05:05:23.661325Z",
            "url": "https://files.pythonhosted.org/packages/ac/af/fa01b407d172da5a498a25b7f362b43dceb9888da4cb3d112be8beb4da88/VChat-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "338ded97e588b23ab5dfdfe7a395ee49ce5c3f310f5f0e0e00950cdae31d5ddf",
                "md5": "074ca0616a2f0e3d2aad61796343e7b3",
                "sha256": "8ffc46197f947e0ec0c3bea88e02260124162ae190a6da17ed8bbd1120425bc2"
            },
            "downloads": -1,
            "filename": "vchat-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "074ca0616a2f0e3d2aad61796343e7b3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 33406,
            "upload_time": "2024-12-15T05:05:26",
            "upload_time_iso_8601": "2024-12-15T05:05:26.308503Z",
            "url": "https://files.pythonhosted.org/packages/33/8d/ed97e588b23ab5dfdfe7a395ee49ce5c3f310f5f0e0e00950cdae31d5ddf/vchat-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-15 05:05:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "z2z63",
    "github_project": "VChat",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pyqrcode",
            "specs": [
                [
                    "~=",
                    "1.2.1"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    "~=",
                    "3.9.1"
                ]
            ]
        },
        {
            "name": "yarl",
            "specs": [
                [
                    "~=",
                    "1.9.4"
                ]
            ]
        },
        {
            "name": "lxml",
            "specs": [
                [
                    "~=",
                    "5.2.2"
                ]
            ]
        }
    ],
    "lcname": "vchat"
}
        
Elapsed time: 1.50277s