From 8d1a614daaf7eeb0ddad73009d4971cca5c8e368 Mon Sep 17 00:00:00 2001 From: LaysDragon Date: Tue, 16 Jul 2024 11:43:49 +0800 Subject: [PATCH] feat(discord): support sticker elements (#284) --- adapters/discord/src/utils.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/adapters/discord/src/utils.ts b/adapters/discord/src/utils.ts index 1619f973..7f210da8 100644 --- a/adapters/discord/src/utils.ts +++ b/adapters/discord/src/utils.ts @@ -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 += ' '