From 3662ee5db61f71e892f7938034abbd9027df186a Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Mon, 30 Sep 2024 22:50:19 +1300 Subject: [PATCH] Fix interaction updates --- src/d2m/converters/message-to-event.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/d2m/converters/message-to-event.js b/src/d2m/converters/message-to-event.js index 582b26cb..3466b4ce 100644 --- a/src/d2m/converters/message-to-event.js +++ b/src/d2m/converters/message-to-event.js @@ -236,8 +236,11 @@ async function messageToEvent(message, guild, options = {}, di) { const interaction = message.interaction_metadata || message.interaction if (message.type === DiscordTypes.MessageType.ChatInputCommand && interaction && "name" in interaction) { // Commands are sent by the responding bot. Need to attach the metadata of the person using the command at the top. - if (message.content) message.content = `\n${message.content}` - message.content = `> ↪️ <@${interaction.user.id}> used \`/${interaction.name}\`${message.content}` + let content = message.content + if (content) content = `\n${content}` + else if ((message.flags || 0) & DiscordTypes.MessageFlags.Loading) content = " — interaction loading..." + content = `> ↪️ <@${interaction.user.id}> used \`/${interaction.name}\`${content}` + message = {...message, content} // editToChanges reuses the object so we can't mutate it. have to clone it } /**