I have embed with buttons. When buttons are clicked interactionCreate event is triggered. It used to show red message This interaction has failed, because I don't want the bot to reply in chat each time a button is clicked, so I added
buttonInteraction.deferUpdate();
to prevent that.
Now the buttons work fine and the This interaction has failed doesn't appear.
However I'd like to change the style of a button that was pressed.
I tried to do
buttonInteraction.component.disabled = true;
buttonInteraction.component.style = 3;
buttonInteraction.edit({component: buttonInteraction.component});
But I get a TypeError: interaction.edit is not a function error.
Changing it to editReply results in Error [INTERACTION_NOT_REPLIED]: The reply to this interaction has not been sent or deferred. error:
buttonInteraction.component.disabled = true;
buttonInteraction.component.style = 3;
buttonInteraction.editReply({component: buttonInteraction.component});
Changing it to
buttonInteraction.update({component: buttonInteraction.component});
causes DiscordAPIError: Interaction has already been acknowledged. error
I'm not sure what is wrong and would appreciate any help!