edit if deferred or replied

This commit is contained in:
itsMapleLeaf
2023-09-27 22:48:00 -05:00
parent 156cf90919
commit 104b175931
2 changed files with 10 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"reacord": patch
---
ensure message is edited from arbitrary component updates

View File

@@ -245,7 +245,11 @@ export class ReacordDiscordJs extends Reacord {
id: interaction.id,
customId: interaction.customId,
update: async (options: MessageOptions) => {
await interaction.update(getDiscordMessageOptions(options))
if (interaction.deferred || interaction.replied) {
await interaction.message.edit(getDiscordMessageOptions(options))
} else {
await interaction.update(getDiscordMessageOptions(options))
}
},
deferUpdate: async () => {
if (interaction.replied || interaction.deferred) return