From 56e5ca16f5c7c63d016a5959b3987f82a0331673 Mon Sep 17 00:00:00 2001 From: Lain <1072411694@qq.com> Date: Sun, 24 Mar 2024 11:14:31 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=8F=AF=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E9=9D=9Ebot=E9=80=82=E9=85=8D=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/server/server.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/server/server.js b/lib/server/server.js index 61fcfba..37c4c3b 100644 --- a/lib/server/server.js +++ b/lib/server/server.js @@ -16,8 +16,11 @@ export default async function Server () { try { const Adapter = Bot.server[url] const adapter = new Adapter(socket, request) - await adapter.isInit - Bot.adapter[headers['x-self-id']] = adapter + const id = headers['x-self-id'] + if (id) { + await adapter.isInit + Bot.adapter[id] = adapter + } } catch (e) { logger.error(`[WebSocket连接][找不到适配器]:${url}`, e) }