Skip to content

Commit

Permalink
fix(inspect): correct behavior in /inspect quote
Browse files Browse the repository at this point in the history
  • Loading branch information
yhx-12243 committed Jun 28, 2024
1 parent b246289 commit 39c5506
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/common/inspect/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions plugins/common/inspect/tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,14 @@ describe('@koishijs/plugin-inspect', () => {
await client.shouldReply('inspect <at id="321"/>', '用户 ID:321')
await client.shouldReply('inspect <sharp id="654"/>', '频道 ID:654')
await client.shouldReply('inspect foobar', '参数无法解析。')

await client.shouldReply('<quote id="114514"/> inspect foobar', new RegExp([
'平台名:mock',
'消息 ID:114514',
'频道 ID:.*',
'群组 ID:456',
'用户 ID:.*',
'自身 ID:514',
].join('\n')))
})
})

0 comments on commit 39c5506

Please sign in to comment.