Toggle Interaction.acknowledged in defer (#3022)

This commit is contained in:
Endy
2023-05-06 14:57:43 +00:00
committed by GitHub
parent 4a6e22d192
commit 2b83d691b3
+5 -3
View File
@@ -128,14 +128,16 @@ const baseInteraction: Partial<Interaction> & BaseInteraction = {
if (this.acknowledged) throw new Error('Cannot defer an already responded interaction')
// Determine the type of defer response
let type: InteractionResponseTypes
if (this.type === InteractionTypes.MessageComponent) type = InteractionResponseTypes.DeferredUpdateMessage
else type = InteractionResponseTypes.DeferredChannelMessageWithSource
const type =
this.type === InteractionTypes.MessageComponent
? InteractionResponseTypes.DeferredUpdateMessage
: InteractionResponseTypes.DeferredChannelMessageWithSource
// If user wants to send a private message
const data: InteractionCallbackData = {}
if (isPrivate) data.flags = 64
this.acknowledged = true
return await this.bot?.rest.sendInteractionResponse(this.id!, this.token!, { type, data })
},