feat: 添加aiocqhttp对Token设置的支持

This commit is contained in:
Raven95676
2025-04-28 22:14:51 +08:00
parent 07f277dd3b
commit fdf55221e6
2 changed files with 11 additions and 2 deletions
+7 -1
View File
@@ -140,6 +140,7 @@ CONFIG_METADATA_2 = {
"enable": False,
"ws_reverse_host": "0.0.0.0",
"ws_reverse_port": 6199,
"ws_reverse_token": "",
},
"gewechat(微信)": {
"id": "gwchat",
@@ -188,7 +189,7 @@ CONFIG_METADATA_2 = {
"telegram_file_base_url": "https://api.telegram.org/file/bot",
"telegram_command_register": True,
"telegram_command_auto_refresh": True,
"telegram_command_register_interval": 300
"telegram_command_register_interval": 300,
},
},
"items": {
@@ -258,6 +259,11 @@ CONFIG_METADATA_2 = {
"type": "int",
"hint": "aiocqhttp 适配器的反向 Websocket 端口。",
},
"ws_reverse_token": {
"description": "反向 Websocket Token",
"type": "string",
"hint": "aiocqhttp 适配器的反向 Websocket Token。未设置则不启用 Token 验证。",
},
"lark_bot_name": {
"description": "飞书机器人的名字",
"type": "string",
@@ -46,7 +46,10 @@ class AiocqhttpAdapter(Platform):
)
self.bot = CQHttp(
use_ws_reverse=True, import_name="aiocqhttp", api_timeout_sec=180
use_ws_reverse=True,
import_name="aiocqhttp",
api_timeout_sec=180,
access_token=platform_config["ws_reverse_token"],
)
@self.bot.on_request()