Skip to content

Commit

Permalink
fix(kook): <kook:card> with text only will not send card
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Dec 26, 2023
1 parent 662db18 commit 756b051
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions adapters/kook/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export class KookMessageEncoder<C extends Context = Context> extends MessageEnco
})
}

async flush() {
if (this.cardBuffer.modules.length) {
async flush(forceCard = false) {
if (this.cardBuffer.modules.length || forceCard) {
this.flushText()
await this.post(Kook.Type.card, JSON.stringify([this.cardBuffer]))
this.cardBuffer = {
Expand Down Expand Up @@ -233,7 +233,7 @@ export class KookMessageEncoder<C extends Context = Context> extends MessageEnco
this.cardBuffer.theme = attrs['kook:theme'] ?? (Kook.Card.Theme.includes(attrs.class) ? attrs.class : 'primary')
this.cardBuffer.size = attrs['kook:size']
await this.render(children)
await this.flush()
await this.flush(true)
} else if (type === 'quote') {
await this.flush()
this.additional.quote = attrs.id
Expand Down

0 comments on commit 756b051

Please sign in to comment.