From 39c55061ea1585c7cae91b00fe25c4aa98defcde Mon Sep 17 00:00:00 2001 From: yhx-12243 Date: Thu, 27 Jun 2024 22:19:39 -0400 Subject: [PATCH] fix(inspect): correct behavior in /inspect quote --- plugins/common/inspect/src/index.ts | 1 + plugins/common/inspect/tests/index.spec.ts | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/plugins/common/inspect/src/index.ts b/plugins/common/inspect/src/index.ts index 1013eb772d..efd5186aaf 100644 --- a/plugins/common/inspect/src/index.ts +++ b/plugins/common/inspect/src/index.ts @@ -15,6 +15,7 @@ export function apply(ctx: Context) { if (session.quote) { return session.text('.message', { platform: session.platform, + messageId: session.quote.id, guildId: session.guildId, selfId: session.selfId, userId: session.quote.user?.id, diff --git a/plugins/common/inspect/tests/index.spec.ts b/plugins/common/inspect/tests/index.spec.ts index d6fdf040c9..9540ef492b 100644 --- a/plugins/common/inspect/tests/index.spec.ts +++ b/plugins/common/inspect/tests/index.spec.ts @@ -26,5 +26,14 @@ describe('@koishijs/plugin-inspect', () => { await client.shouldReply('inspect ', '用户 ID:321') await client.shouldReply('inspect ', '频道 ID:654') await client.shouldReply('inspect foobar', '参数无法解析。') + + await client.shouldReply(' inspect foobar', new RegExp([ + '平台名:mock', + '消息 ID:114514', + '频道 ID:.*', + '群组 ID:456', + '用户 ID:.*', + '自身 ID:514', + ].join('\n'))) }) })