Skip to content

Commit

Permalink
fix(discord): fix error when THREAD_CREATED, fix #306
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Aug 14, 2024
1 parent bb02f1d commit a6bbf1a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion adapters/discord/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ export async function decodeMessage(
}
message.elements = h.parse(message.content)
// 遇到过 cross post 的消息在这里不会传消息 id
if (details && data.message_reference) {
// https://github.com/satorijs/satori/issues/306
// THREAD_CREATED (18) 事件下,message_reference 没有 message_id
// THREAD_STARTER_MESSAGE (21) 事件下,message_reference 有 message_id
if (details && data.message_reference?.message_id) {
const { message_id, channel_id } = data.message_reference
message.quote = await bot.getMessage(channel_id, message_id, false)
}
Expand Down

0 comments on commit a6bbf1a

Please sign in to comment.