From 8b4704f649a6cca49af36f1a6be4316e2c00091b Mon Sep 17 00:00:00 2001 From: sliverp Date: Thu, 5 Feb 2026 21:11:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E7=8A=B6=E6=80=81=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gateway.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gateway.ts b/src/gateway.ts index ce6d78d..7e45b24 100644 --- a/src/gateway.ts +++ b/src/gateway.ts @@ -602,6 +602,14 @@ openclaw cron add \\ : `qqbot:c2c:${event.senderId}`; const toAddress = fromAddress; + // 计算命令授权状态 + // allowFrom: ["*"] 表示允许所有人,否则检查 senderId 是否在 allowFrom 列表中 + const allowFromList = account.config?.allowFrom ?? []; + const allowAll = allowFromList.length === 0 || allowFromList.some((entry: string) => entry === "*"); + const commandAuthorized = allowAll || allowFromList.some((entry: string) => + entry.toUpperCase() === event.senderId.toUpperCase() + ); + const ctxPayload = pluginRuntime.channel.reply.finalizeInboundContext({ Body: body, RawBody: event.content, @@ -622,6 +630,7 @@ openclaw cron add \\ QQChannelId: event.channelId, QQGuildId: event.guildId, QQGroupOpenid: event.groupOpenid, + CommandAuthorized: commandAuthorized, }); // 发送消息的辅助函数,带 token 过期重试