Skip to content

Commit

Permalink
feat(discord): support sticker elements (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaysDragon authored Jul 16, 2024
1 parent 4a1f487 commit 8d1a614
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions adapters/discord/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ export async function decodeMessage(
})
}

if (data.sticker_items) {
message.content += data.sticker_items.map(s => h('sticker', {
id: s.id,
format_type: s.format_type,
name: s.name,
}, [
h.image(`https://media.discordapp.net/stickers/${s.id}.webp?size=160`),
])).join('')
}

// embed 的 update event 太阴间了 只有 id embeds channel_id guild_id 四个成员
if (data.attachments?.length) {
if (!/\s$/.test(message.content)) message.content += ' '
Expand Down

0 comments on commit 8d1a614

Please sign in to comment.