Need help with pagination
hello
can someone please help me with this issue i'm facing with pagination buttons
player.js command file code: https://pastebin.com/AARaEK7v
pagination.js code: https://pastebin.com/Rv0ctPTV
when i'm using await i.deferUpdate(); the buttons don't work and i get below error in logs:
DiscordAPIError[10062]: Unknown interaction
at handleErrors (D:\git\rtd-bot\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (D:\git\rtd-bot\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (D:\git\rtd-bot\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ButtonInteraction.deferUpdate (D:\git\rtd-bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:200:5)
at async InteractionCollector.<anonymous> (D:\git\rtd-bot\src\events\playerPagination.js:49:13) {
requestBody: { files: undefined, json: { type: 6 } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1316040646011654216/aW50ZXJhY3Rpb246MTMxNjA0MDY0NjAxMTY1NDIxNjpUSUFnUDg5alEyZzhIQjBWRlVQdVlicDhjZlFiMVpPbWk1d3JQRDhKV0cxTmlIcTVLaFl1cnhIRWJGNXQ2RlhiOHdNWFdQUDRtMGtzbHJaQXBxWDZlSGJIU2tXWDZaS1Q1eG5YdzZqSmt5ZjhxSU04MHhLS043UUtUZlZzbzlXag/callback'
}
when i remove it, the buttons work, i don't get any exception in logs, but i get an ephemeral saying there was an error as seen in the image attached
tried it with external pagination modules like @devraelfreeze/discordjs-pagination
and pagination-djs as well, same thing is happeningPastebin
module.exports = { name: 'player', description: 'Fetch player dat...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, ComponentType...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
6 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPtried on both [email protected] and [email protected]
still getting unknown interaction
Show the error
DiscordAPIError[10062]: Unknown interaction
at handleErrors (D:\git\rtd-bot\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:727:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (D:\git\rtd-bot\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:831:23)
at async _REST.request (D:\git\rtd-bot\node_modules\discord.js\node_modules\@discordjs\rest\dist\index.js:1272:22)
at async ButtonInteraction.update (D:\git\rtd-bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:237:5)
at async InteractionCollector.<anonymous> (D:\git\rtd-bot\src\events\playerPagination.js:76:17) {
requestBody: {
files: [],
json: {
type: 7,
data: {
content: undefined,
tts: false,
nonce: undefined,
enforce_nonce: false,
embeds: [
{
color: 0,
title: 'Page 2',
description: 'This is the second page with default content.'
}
],
components: [ { type: 1, components: [Array] } ],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined,
applied_tags: undefined,
poll: undefined
}
}
},
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1316090639003422810/aW50ZXJhY3Rpb246MTMxNjA5MDYzOTAwMzQyMjgxMDppTnVJVzE4dFRkbTVKS29ZMExNdEZ2S0tDSndFdjBiOWp6TENVaXdDYTJDR0duRVNrU2lLcUJKWW1LY1lWQmM1ZGJRNWQzVTM5Y1haYkpCcllwQW56eE1NempTVXNBaFQ3aTl2dWZNQ3RuU1RTb0VCVXY0anRNeUFnZ25YdnFLTA/callback'
}
this is after i changed msg.edit to i.update
the button doesn't work and i get an ephemeral saying 'There was an error' (image below)i thought it's a default ephemeral, but after you said it's custom, i checked and found below in my interaction event handler:
const button = client.buttons.get(interaction.customId);
if (!button)
return await interaction.reply({
content: "There was an error",
ephemeral: true,
});
try {
await button.execute(interaction, client);
} catch (err) {
console.log(err);
await interaction.reply({
content: "There was an error executing this button",
ephemeral: true,
});
}
that's the only place where i see that ephemeral message in entire code
i think i understand it now, i have separate button files for other buttons but not these, there is a button handler file which scans the package for button files
so do you think that's the issue?
thank you so so much, you're a lifesaver 🤍🤍
i removed the handler and it's working fine now