Update original Interaction reply from ButtonInteraction

How can I edit the original interaction reply from within a ButtonInteraction handler?
20 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt2y ago
I can't because the original interaction is a CommandInteraction
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt2y ago
Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt2y ago
Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
at ButtonInteraction.editReply (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:150:48)
at ZamorakButtonMenuInteractionHandler (C:\Users\John\source\repos\UltimatumsBot\src\bot\handlers\zammy-handlers\ZamorakButtonMenuInteractionHandler.ts:12:27)
at InteractionCreateHandler (C:\Users\John\source\repos\UltimatumsBot\src\bot\handlers\InteractionCreateHandler.ts:29:46)
at Client.<anonymous> (C:\Users\John\source\repos\UltimatumsBot\src\bot\client.ts:30:82)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
at Object.module.exports [as INTERACTION_CREATE] (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
at WebSocketShard.onPacket (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:480:22)
at WebSocketShard.onMessage (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:320:10)
[ERROR] 20:55:30 Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
at ButtonInteraction.editReply (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:150:48)
at ZamorakButtonMenuInteractionHandler (C:\Users\John\source\repos\UltimatumsBot\src\bot\handlers\zammy-handlers\ZamorakButtonMenuInteractionHandler.ts:12:27)
at InteractionCreateHandler (C:\Users\John\source\repos\UltimatumsBot\src\bot\handlers\InteractionCreateHandler.ts:29:46)
at Client.<anonymous> (C:\Users\John\source\repos\UltimatumsBot\src\bot\client.ts:30:82)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
at Object.module.exports [as INTERACTION_CREATE] (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
at WebSocketShard.onPacket (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:480:22)
at WebSocketShard.onMessage (C:\Users\John\source\repos\UltimatumsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:320:10)
[ERROR] 20:55:30 Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt2y ago
// SomeCommand.ts - command interaction
...
await interaction.deferReply();
// fetch data
...
await interaction.editReply({
embeds: [embed],
components: [buttons],
});


// ButtonInteractionHandler.ts
const ButtonMenuInteractionHandler = async (buttonInteraction: ButtonInteraction) => {
await buttonInteraction.editReply({ content: "test" });
};
// SomeCommand.ts - command interaction
...
await interaction.deferReply();
// fetch data
...
await interaction.editReply({
embeds: [embed],
components: [buttons],
});


// ButtonInteractionHandler.ts
const ButtonMenuInteractionHandler = async (buttonInteraction: ButtonInteraction) => {
await buttonInteraction.editReply({ content: "test" });
};
Yeah, I want to edit the CommandInteraction reply Not the button interaction one
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt2y ago
When 2 Player button is clicked, I want the embed to change The embed comes from CommandInteraction
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt2y ago
They're in different files, I don't have access to interaction anymore That's the whole point of this question, how can I get access to the original interaction lol from the ButtonInteraction
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt2y ago
What Why the attitude?
d.js docs
d.js docs2y ago
method ButtonInteraction#update() Updates the original message of the component on which the interaction was received on.
MrMythical
MrMythical2y ago
can't you use this?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt2y ago
Perfect, just what I was looking for - appreciate your help mate It's your condescending tone.
MrMythical
MrMythical2y ago
stop, this is a support channel