Skip to content

Commit

Permalink
fix(satori): strip leading <quote>, fix koishijs/koishi#1395
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jul 30, 2024
1 parent 09a931c commit 5854fed
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/core/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@ export class Session<C extends Context = Context> {

set content(value: string | undefined) {
this.event.message ??= {}
this.event.message.quote = undefined
this.event.message.elements = isNullable(value) ? value : h.parse(value)
if (this.event.message.elements?.[0]?.type === 'quote') {
const el = this.event.message.elements.shift()
this.event.message.quote = {
...el.attrs,
content: el.children.join(''),
}
}
}

setInternal(type: string, data: any) {
Expand Down

0 comments on commit 5854fed

Please sign in to comment.