From cbde6d5bba9fafe2c287f12a97a12f3b9bbac123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=91=9C=E7=AC=99?= <2624367622@qq.com> Date: Sun, 15 Feb 2026 12:55:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ws=E8=BF=9E=E6=8E=A5=E6=94=AF=E6=8C=81al?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- components/WebSocket.js | 24 ++++++++++++++++++++++++ config/default_config/ws-config.yaml | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a62492f..ef16659 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ config/config/* model/db/data.db model/satori **/test.js -!.gitignore \ No newline at end of file +!.gitignore +pnpm-lock.yaml \ No newline at end of file diff --git a/components/WebSocket.js b/components/WebSocket.js index 8bc4a43..e9bb289 100644 --- a/components/WebSocket.js +++ b/components/WebSocket.js @@ -61,6 +61,30 @@ async function createWebSocket (data) { delete data.close } data.rawName = data.rawName || data.name + if (data.uin === 'all') { + let uinList = [] + if (global.Bot) { + if (Array.isArray(global.Bot.uin)) { + uinList = _.cloneDeep(global.Bot.uin) + } else { + uinList = [global.Bot.uin] + for (const i in global.Bot) { + const uinNum = Number(i) + if (/^\d{5,12}$/.test(i) && !uinList.includes(uinNum)) { + uinList.push(uinNum) + } + } + } + } + // Filter out invalid uins if any + uinList = uinList.filter(u => u) + + if (uinList.length > 0) { + data.uin = uinList + await createWebSocket(data) + return + } + } if (Array.isArray(data.uin)) { for (const uin of data.uin) { const str = String(uin) diff --git a/config/default_config/ws-config.yaml b/config/default_config/ws-config.yaml index 6af0113..4187cb4 100644 --- a/config/default_config/ws-config.yaml +++ b/config/default_config/ws-config.yaml @@ -31,6 +31,7 @@ onlyReplyAt: # maxReconnectAttempts: 最大连接次数 0 为无限制 # accessToken: 鉴权token # accessKey: 鉴权token的前缀 比如Bearer 默认为Token +# uin: 绑定的Bot账号, 可填all绑定所有Bot servers: - name: ws_name address: ws_address