nonebridge


Namenonebridge JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/ColdThunder11/nonebot-adapter-telegram
SummaryA adapter event bridge for nonebot2 makes plugins run on different adapters without any modify
upload_time2023-07-26 04:46:57
maintainer
docs_urlNone
authorColdThunder11
requires_python>=3.8.1,<4.0.0
licenseMIT
keywords bot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nonebridge
A adapter event bridge for nonebot2 makes plugins running on different adapters without any modify   
一个让你能够在不修改插件的情况下使其运行在不同adapter中的魔法bridge,开发目的是为了给[Yuki Clanbattle](https://github.com/ColdThunder11/yuki_clanbattle)提供Telegram支持
## 还在开发中请勿生产环境使用
女生自用插件,目前仅支持让为onebotv11编写的插件运行在自己写的[nonebot-adapter-telegram](https://github.com/ColdThunder11/nonebot-adapter-telegram)上,仅会支持有限的消息类型和API模拟   
目前不支持~~主动发送消息和~~向非事件触发的聊天发送消息,支持主动向群聊使用send_group_msg发送群组消息了(必须在tg端收到任意消息后虚假的obv11 bot连接才会被注册)
## 支持的接收类型
- [x] 纯文字(MessageSegment.text)
- [x] 图片(MessageSegment.image)

## 支持的发送类型
- [x] 文字(MessageSegment.text)
- [x] 图片(MessageSegment.image)
- [x] AT(MessageSegment.at)
- [x] 语音(MessageSegment.record)

## 支持的额外API
| Onebot v11 API        | 对应的Telegarm API                                                       |
| --------------------- | ------------------------------------------------------------------------ |
| get_group_info        | getChat和getChatMemberCount                                              |
| get_group_member_list | getChatAdministrators(由于tg并没有提供相关API,仅能够直接获取管理员信息) |
| get_group_member_info | getChatMember                                                            |
| send_group_msg        | ---                                                                      |
## 配置
nonebridge所需的配置直接写入到nonebot2的.env文件内即可
```
nonebridge_ob11_caption_ahead_photo: 将从telegram收到的带文字描述的图片消息中文字部分作为文字消息在ob11的消息段中前置以配合ob11中大部分插件的习惯写法,默认为True
nonebridge_httpx_hook: 安装httpx钩子以拦截获取qq头像的http api,默认为False
ob11_plugin_list: [] 需要强制处理为ob11消息的插件,该插件内的matcer将不会被tg消息触发
```

## 使用方法
同时安装并两个adapter,在bot.py紧随nonebot之后导入nonebridge,必须在任何adapter导入之前导入nonebridge,需要同时注册两个Adapter才能正常运行   
### Example bot.py
```python
import nonebot
import nonebridge
from nonebot.adapters.onebot.v11 import Adapter as OneBot_V11_Adapter
from nonebot.adapters.telegram.adapter import Adapter as Telegram_Adapter

nonebot.init()
driver = nonebot.get_driver()
driver.register_adapter(OneBot_V11_Adapter)
driver.register_adapter(Telegram_Adapter)
nonebot.load_plugin("your_onebotv11_plugin")

if __name__ == "__main__":
    nonebot.run()   
```
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ColdThunder11/nonebot-adapter-telegram",
    "name": "nonebridge",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.1,<4.0.0",
    "maintainer_email": "",
    "keywords": "bot",
    "author": "ColdThunder11",
    "author_email": "lslyj27761@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bb/f7/4e6199353a41620c3771d4dfd9a53d1fefd8af01db656efdf7e9c189174b/nonebridge-0.1.5.tar.gz",
    "platform": null,
    "description": "# nonebridge\nA adapter event bridge for nonebot2 makes plugins running on different adapters without any modify   \n\u4e00\u4e2a\u8ba9\u4f60\u80fd\u591f\u5728\u4e0d\u4fee\u6539\u63d2\u4ef6\u7684\u60c5\u51b5\u4e0b\u4f7f\u5176\u8fd0\u884c\u5728\u4e0d\u540cadapter\u4e2d\u7684\u9b54\u6cd5bridge\uff0c\u5f00\u53d1\u76ee\u7684\u662f\u4e3a\u4e86\u7ed9[Yuki Clanbattle](https://github.com/ColdThunder11/yuki_clanbattle)\u63d0\u4f9bTelegram\u652f\u6301\n## \u8fd8\u5728\u5f00\u53d1\u4e2d\u8bf7\u52ff\u751f\u4ea7\u73af\u5883\u4f7f\u7528\n\u5973\u751f\u81ea\u7528\u63d2\u4ef6\uff0c\u76ee\u524d\u4ec5\u652f\u6301\u8ba9\u4e3aonebotv11\u7f16\u5199\u7684\u63d2\u4ef6\u8fd0\u884c\u5728\u81ea\u5df1\u5199\u7684[nonebot-adapter-telegram](https://github.com/ColdThunder11/nonebot-adapter-telegram)\u4e0a\uff0c\u4ec5\u4f1a\u652f\u6301\u6709\u9650\u7684\u6d88\u606f\u7c7b\u578b\u548cAPI\u6a21\u62df   \n\u76ee\u524d\u4e0d\u652f\u6301~~\u4e3b\u52a8\u53d1\u9001\u6d88\u606f\u548c~~\u5411\u975e\u4e8b\u4ef6\u89e6\u53d1\u7684\u804a\u5929\u53d1\u9001\u6d88\u606f\uff0c\u652f\u6301\u4e3b\u52a8\u5411\u7fa4\u804a\u4f7f\u7528send_group_msg\u53d1\u9001\u7fa4\u7ec4\u6d88\u606f\u4e86(\u5fc5\u987b\u5728tg\u7aef\u6536\u5230\u4efb\u610f\u6d88\u606f\u540e\u865a\u5047\u7684obv11 bot\u8fde\u63a5\u624d\u4f1a\u88ab\u6ce8\u518c)\n## \u652f\u6301\u7684\u63a5\u6536\u7c7b\u578b\n- [x] \u7eaf\u6587\u5b57(MessageSegment.text)\n- [x] \u56fe\u7247(MessageSegment.image)\n\n## \u652f\u6301\u7684\u53d1\u9001\u7c7b\u578b\n- [x] \u6587\u5b57(MessageSegment.text)\n- [x] \u56fe\u7247(MessageSegment.image)\n- [x] AT(MessageSegment.at)\n- [x] \u8bed\u97f3(MessageSegment.record)\n\n## \u652f\u6301\u7684\u989d\u5916API\n| Onebot v11 API        | \u5bf9\u5e94\u7684Telegarm API                                                       |\n| --------------------- | ------------------------------------------------------------------------ |\n| get_group_info        | getChat\u548cgetChatMemberCount                                              |\n| get_group_member_list | getChatAdministrators(\u7531\u4e8etg\u5e76\u6ca1\u6709\u63d0\u4f9b\u76f8\u5173API\uff0c\u4ec5\u80fd\u591f\u76f4\u63a5\u83b7\u53d6\u7ba1\u7406\u5458\u4fe1\u606f) |\n| get_group_member_info | getChatMember                                                            |\n| send_group_msg        | ---                                                                      |\n## \u914d\u7f6e\nnonebridge\u6240\u9700\u7684\u914d\u7f6e\u76f4\u63a5\u5199\u5165\u5230nonebot2\u7684.env\u6587\u4ef6\u5185\u5373\u53ef\n```\nnonebridge_ob11_caption_ahead_photo: \u5c06\u4ecetelegram\u6536\u5230\u7684\u5e26\u6587\u5b57\u63cf\u8ff0\u7684\u56fe\u7247\u6d88\u606f\u4e2d\u6587\u5b57\u90e8\u5206\u4f5c\u4e3a\u6587\u5b57\u6d88\u606f\u5728ob11\u7684\u6d88\u606f\u6bb5\u4e2d\u524d\u7f6e\u4ee5\u914d\u5408ob11\u4e2d\u5927\u90e8\u5206\u63d2\u4ef6\u7684\u4e60\u60ef\u5199\u6cd5\uff0c\u9ed8\u8ba4\u4e3aTrue\nnonebridge_httpx_hook: \u5b89\u88c5httpx\u94a9\u5b50\u4ee5\u62e6\u622a\u83b7\u53d6qq\u5934\u50cf\u7684http api\uff0c\u9ed8\u8ba4\u4e3aFalse\nob11_plugin_list: [] \u9700\u8981\u5f3a\u5236\u5904\u7406\u4e3aob11\u6d88\u606f\u7684\u63d2\u4ef6\uff0c\u8be5\u63d2\u4ef6\u5185\u7684matcer\u5c06\u4e0d\u4f1a\u88abtg\u6d88\u606f\u89e6\u53d1\n```\n\n## \u4f7f\u7528\u65b9\u6cd5\n\u540c\u65f6\u5b89\u88c5\u5e76\u4e24\u4e2aadapter\uff0c\u5728bot.py\u7d27\u968fnonebot\u4e4b\u540e\u5bfc\u5165nonebridge\uff0c\u5fc5\u987b\u5728\u4efb\u4f55adapter\u5bfc\u5165\u4e4b\u524d\u5bfc\u5165nonebridge\uff0c\u9700\u8981\u540c\u65f6\u6ce8\u518c\u4e24\u4e2aAdapter\u624d\u80fd\u6b63\u5e38\u8fd0\u884c   \n### Example bot.py\n```python\nimport nonebot\nimport nonebridge\nfrom nonebot.adapters.onebot.v11 import Adapter as OneBot_V11_Adapter\nfrom nonebot.adapters.telegram.adapter import Adapter as Telegram_Adapter\n\nnonebot.init()\ndriver = nonebot.get_driver()\ndriver.register_adapter(OneBot_V11_Adapter)\ndriver.register_adapter(Telegram_Adapter)\nnonebot.load_plugin(\"your_onebotv11_plugin\")\n\nif __name__ == \"__main__\":\n    nonebot.run()   \n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A adapter event bridge for nonebot2 makes plugins run on different adapters without any modify",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/ColdThunder11/nonebot-adapter-telegram",
        "Repository": "https://github.com/ColdThunder11/nonebot-adapter-telegram"
    },
    "split_keywords": [
        "bot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3cd17479992435998ac69969edb13bc5de6af6a9ea08234552d3cc5705f74af9",
                "md5": "20f9fd293305b4b06c380801dec0a768",
                "sha256": "7c09a72f10467c38f673888e90adaeb58a845c2c4f944275d754d912457162c2"
            },
            "downloads": -1,
            "filename": "nonebridge-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "20f9fd293305b4b06c380801dec0a768",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1,<4.0.0",
            "size": 7627,
            "upload_time": "2023-07-26T04:46:54",
            "upload_time_iso_8601": "2023-07-26T04:46:54.972549Z",
            "url": "https://files.pythonhosted.org/packages/3c/d1/7479992435998ac69969edb13bc5de6af6a9ea08234552d3cc5705f74af9/nonebridge-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bbf74e6199353a41620c3771d4dfd9a53d1fefd8af01db656efdf7e9c189174b",
                "md5": "b2990bfa847572ab6bf995346b0e8505",
                "sha256": "e7051754041e152d8150ab64dc8fd0ad228f0b7eab7fa127706b34d05b0a58bd"
            },
            "downloads": -1,
            "filename": "nonebridge-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "b2990bfa847572ab6bf995346b0e8505",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1,<4.0.0",
            "size": 7174,
            "upload_time": "2023-07-26T04:46:57",
            "upload_time_iso_8601": "2023-07-26T04:46:57.042036Z",
            "url": "https://files.pythonhosted.org/packages/bb/f7/4e6199353a41620c3771d4dfd9a53d1fefd8af01db656efdf7e9c189174b/nonebridge-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-26 04:46:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ColdThunder11",
    "github_project": "nonebot-adapter-telegram",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nonebridge"
}
        
Elapsed time: 2.25550s