diff --git a/addons/dashboard/helper.py b/addons/dashboard/helper.py index fce45c825..e28069c86 100644 --- a/addons/dashboard/helper.py +++ b/addons/dashboard/helper.py @@ -104,14 +104,14 @@ class DashBoardHelper(): ) qq_gocq_platform_group = DashBoardConfig( config_type="group", - name="GO-CQHTTP 平台配置", + name="OneBot协议平台配置", description="", body=[ DashBoardConfig( config_type="item", val_type="bool", - name="启用 GO-CQHTTP 平台", - description="gocq 是一个基于 HTTP 协议的 CQHTTP 协议的实现。详见 github.com/Mrs4s/go-cqhttp", + name="启用", + description="支持cq-http、shamrock等(目前仅支持QQ平台)", value=config['gocqbot']['enable'], path="gocqbot.enable", ), @@ -135,7 +135,7 @@ class DashBoardHelper(): config_type="item", val_type="int", name="WebSocket 服务器端口", - description="", + description="目前仅支持正向 WebSocket", value=config['gocq_websocket_port'], path="gocq_websocket_port", ), diff --git a/addons/dashboard/server.py b/addons/dashboard/server.py index 292ae46c5..1d71854a7 100644 --- a/addons/dashboard/server.py +++ b/addons/dashboard/server.py @@ -332,8 +332,8 @@ class AstrBotDashBoard(): "tag": "" }, { - "title": "QQ_GOCQ", - "desc": "go-cqhttp", + "title": "OneBot协议", + "desc": "支持cq-http、shamrock等(目前仅支持QQ平台)", "namespace": "internal_platform_qq_gocq", "tag": "" } diff --git a/cores/qqbot/core.py b/cores/qqbot/core.py index 4dd2f57b2..144f512c6 100644 --- a/cores/qqbot/core.py +++ b/cores/qqbot/core.py @@ -254,13 +254,16 @@ def run_qqchan_bot(cfg: dict, global_object: GlobalObject): def run_gocq_bot(cfg: dict, _global_object: GlobalObject): from model.platform.qq_gocq import QQGOCQ - logger.log("正在检查本地GO-CQHTTP连接...端口5700, 6700", tag="QQ") noticed = False + host = cc.get("gocq_host", "127.0.0.1") + port = cc.get("gocq_websocket_port", 6700) + http_port = cc.get("gocq_http_port", 5700) + logger.log(f"正在检查连接...host: {host}, ws port: {port}, http port: {http_port}", tag="QQ") while True: - if not gu.port_checker(5700, cc.get("gocq_host", "127.0.0.1")) or not gu.port_checker(6700, cc.get("gocq_host", "127.0.0.1")): + if not gu.port_checker(port=port, host=host) or gu.port_checker(port=http_port, host=host): if not noticed: noticed = True - logger.log("与GO-CQHTTP通信失败, 请检查GO-CQHTTP是否启动并正确配置。程序会每隔 5s 自动重试。", gu.LEVEL_CRITICAL, tag="QQ") + logger.log(f"连接到{host}:{port}(或{http_port})失败。程序会每隔 5s 自动重试。", gu.LEVEL_CRITICAL, tag="QQ") time.sleep(5) else: logger.log("检查完毕,未发现问题。", tag="QQ")