Display "Failed of the interaction" but no logs error and still running well

I've done a pagination on an embed, everything works well when i click on navigation buttons but a very ugly red message show up after buttons seems to searching something, but embed is well edited.
const message = await interaction.reply({
embeds: [embed],
components : [row],
ephemeral: true
});


const collector = message.createMessageComponentCollector({ componentType: ComponentType.Button, time: 2*60*1000 });

collector.on('collect', async i => {
if (i.user.id === interaction.user.id && i.customId === "previous") {
currentPage--;
if (currentPage < 0) {
currentPage = pages.length - 1;
}
} else if (i.user.id === interaction.user.id && i.customId === "next") {
currentPage++;
if (currentPage >= pages.length) {
currentPage = 0;
}
}

const updatedEmbed = createEmbed(pages[currentPage]);

await message.edit({
embeds: [updatedEmbed]
});
});
const message = await interaction.reply({
embeds: [embed],
components : [row],
ephemeral: true
});


const collector = message.createMessageComponentCollector({ componentType: ComponentType.Button, time: 2*60*1000 });

collector.on('collect', async i => {
if (i.user.id === interaction.user.id && i.customId === "previous") {
currentPage--;
if (currentPage < 0) {
currentPage = pages.length - 1;
}
} else if (i.user.id === interaction.user.id && i.customId === "next") {
currentPage++;
if (currentPage >= pages.length) {
currentPage = 0;
}
}

const updatedEmbed = createEmbed(pages[currentPage]);

await message.edit({
embeds: [updatedEmbed]
});
});
Did i missed something ?
5 Replies
d.js toolkit
d.js toolkit2y 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.
Syjalo
Syjalo2y ago
Add fetchReply: true to your interaction reply
Elyana
ElyanaOP2y ago
oh, now i have a console error when clicking on button : have done this change :
const message = await interaction.reply({
embeds: [embed],
components : [row],
fetchReply : true,
ephemeral: true
});
const message = await interaction.reply({
embeds: [embed],
components : [row],
fetchReply : true,
ephemeral: true
});
DiscordAPIError[10008]: Unknown Message at handleErrors (C:\Users\Propriétaire\Documents\Bot Discord\Nemo\node_modules\@discordjs\rest\dist\index.js:640:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async SequentialHandler.runRequest (C:\Users\Propriétaire\Documents\Bot Discord\Nemo\node_modules\@discordjs\rest\dist\index.js:1021:23) at async SequentialHandler.queueRequest (C:\Users\Propriétaire\Documents\Bot Discord\Nemo\node_modules\@discordjs\rest\dist\index.js:862:14) at async REST.request (C:\Users\Propriétaire\Documents\Bot Discord\Nemo\node_modules\@discordjs\rest\dist\index.js:1387:22) at async MessageManager.edit (C:\Users\Propriétaire\Documents\Bot Discord\Nemo\node_modules\discord.js\src\managers\MessageManager.js:176:15) at async InteractionCollector.<anonymous> (C:\Users\Propriétaire\Documents\Bot Discord\Nemo\commands\stacking.js:661:21)
Syjalo
Syjalo2y ago
You should use this with interactions
interaction.editReply({ message, ...otherOptions })
interaction.editReply({ message, ...otherOptions })
Elyana
ElyanaOP2y ago
Oooh, thank you for your advice, you remind me to use the interaction instead of message. And i try the update method instead of edit, editReply
await i.update({
embeds: [updatedEmbed],
});
await i.update({
embeds: [updatedEmbed],
});
And it works well now !! 🥳
Want results from more Discord servers?
Add your server