Click a button and edit the embed

Good morning. I come to you because I would like that when I click on my button, my embed is modified. What I do is that I send my embed with the buttons via a /testvalidation command and I constantly check in interactionCreate if it detects a click on the button. If this button is clicked then I ask him to take back the message stored in interaction and therefore to create a new embed by defining each of the properties that I need and then to create a new button which corresponds to the same button as in my first embed and then modify the message to replace it with the new embed and the new buttons by doing interaction.edit({embeds: [Liste], components: [row]}) out it tells me that edit is not a function... Error :
C:\Users\Elève\Desktop\Project\HeartOfBot\Events\interactionCreate.js:222
await interaction.edit({embeds: [Liste], components: [row]})
^

TypeError: interaction.edit is not a function
at Query.<anonymous> (C:\Users\Elève\Desktop\Project\HeartOfBot\Events\interactionCreate.js:222:47)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Node.js v17.0.0
C:\Users\Elève\Desktop\Project\HeartOfBot\Events\interactionCreate.js:222
await interaction.edit({embeds: [Liste], components: [row]})
^

TypeError: interaction.edit is not a function
at Query.<anonymous> (C:\Users\Elève\Desktop\Project\HeartOfBot\Events\interactionCreate.js:222:47)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Node.js v17.0.0
8 Replies
d.js toolkit
d.js toolkit•16mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Danial
Danial•16mo ago
You either want interaction.update() or interaction.message.edit(), interaction.edit() doesn't exist
🖤 • Nelson • 🖤
So thank you, with interaction.message.edit() I have the change of my embed, however, I have a problem, no error in the console but an error on discord, he tells me that he there is an interaction failure even though it has done what I ask of it, any idea?
Danial
Danial•16mo ago
Yes because interaction.message.edit() isn't a response, you'd wanna use interaction.update() instead
d.js docs
d.js docs•16mo ago
method ButtonInteraction#update() Updates the original message of the component on which the interaction was received on.
Danial
Danial•16mo ago
It works the same but will count as a response
🖤 • Nelson • 🖤
Okay thank you!
Danial
Danial•16mo ago
Of course
Want results from more Discord servers?
Add your server