nonebot / adapter-onebot

NoneBot2 OneBot 适配器 / OneBot adapter for nonebot2
https://onebot.adapters.nonebot.dev
MIT License
79 stars 28 forks source link

Bug: OneBot V11 和 V12 适配器均使用 `ONEBOT_WS_URLS` 配置导致报错 #106

Closed This-is-XiaoDeng closed 5 months ago

This-is-XiaoDeng commented 5 months ago

在同时加载 OneBot V11 和 OneBot V12 适配器时,两个适配器都会对 ONEBOT_WS_URLS 配置的 URL 发起连接。

按照 文档,OneBot V12 适配器应该读取 ONEBOT_V12_WS_URLS 配置,而不是 ONEBOT_WS_URLS 配置。

以下是相关配置及截图:

.env 文件 ```env HOST="0.0.0.0" ALCONNA_USE_COMMAND_START=True DRIVER=~fastapi+~httpx+~websockets PORT=13576 LOG_LEVEL=DEBUG COMMAND_START=["!"] SUPERUSERS=["1744793737"] ONEBOT_ACCESS_TOKEN="xdbot2@xiaodeng_114514" ONEBOT_WS_URLS=["ws://127.0.0.1:3001"] ```
pyproject.toml 中的 tool.nonebot 节 ```toml [tool.nonebot] adapters = [ { name = "OneBot V12", module_name = "nonebot.adapters.onebot.v12" }, { name = "OneBot V11", module_name = "nonebot.adapters.onebot.v11" }, ] plugins = [ "nonebot_plugin_orm", "nonebot_plugin_alconna", "nonebot_plugin_picstatus", "nonebot_plugin_htmlrender", "nonebot_plugin_apscheduler", "nonebot_plugin_session", ] plugin_dirs = ["src/plugins"] builtin_plugins = [] ```
相关日志 ![图片](https://github.com/nonebot/adapter-onebot/assets/104149371/9a3156ad-a1c7-425b-848d-61fe9b417c58)
环境 ![图片](https://github.com/nonebot/adapter-onebot/assets/104149371/15b34b0f-f94d-4b80-9c9b-a985bc5d753c) ![图片](https://github.com/nonebot/adapter-onebot/assets/104149371/4e72efb7-b37b-4985-84ed-8c3a4a092a1a) ![图片](https://github.com/nonebot/adapter-onebot/assets/104149371/5b303123-3d34-4d1e-8354-73573ac379f9)
yanyongyu commented 5 months ago

设计就是这么设计的,为了方便所以可以简写,如果你要同时使用两个适配器,你就不应该简写,v11就用 onebot_v11_ws_urls,v12就用 onebot_v12_ws_urls