Allow edit and deferEdit on modal submit interaction (#4053)

This commit is contained in:
Flash
2024-12-24 10:17:56 +01:00
committed by GitHub
parent bee999b001
commit 6ca797bf4d
+4 -4
View File
@@ -62,8 +62,8 @@ export const baseInteraction: InternalBot['transformers']['$inferredTypes']['int
}
if (!this.acknowledged) {
if (this.type !== InteractionTypes.MessageComponent)
throw new Error("This interaction has not been responded to yet and this isn't a MessageComponent interaction.")
if (this.type !== InteractionTypes.MessageComponent && this.type !== InteractionTypes.ModalSubmit)
throw new Error("This interaction has not been responded to yet and this isn't a MessageComponent or ModalSubmit interaction.")
this.acknowledged = true
return await this.bot.helpers.sendInteractionResponse(
@@ -80,8 +80,8 @@ export const baseInteraction: InternalBot['transformers']['$inferredTypes']['int
if (this.type === InteractionTypes.ApplicationCommandAutocomplete) throw new Error('Cannot edit an autocomplete interaction.')
if (this.acknowledged) throw new Error('Cannot defer an already responded interaction.')
if (this.type !== InteractionTypes.MessageComponent)
throw new Error("Cannot defer to then edit an interaction that isn't a MessageComponent interaction.")
if (this.type !== InteractionTypes.MessageComponent && this.type !== InteractionTypes.ModalSubmit)
throw new Error("Cannot defer to then edit an interaction that isn't a MessageComponent or ModalSubmit interaction.")
this.acknowledged = true
return await this.bot.helpers.sendInteractionResponse(this.id, this.token, { type: InteractionResponseTypes.DeferredUpdateMessage }, options)