#Unknown Interaction on Button Press
5 messages · Page 1 of 1 (latest)
constructor(pages) {
this.pages = pages;
this.currentPage = 0;
this.prevButton = new ButtonBuilder()
.setCustomId('paginator_prev')
.setLabel('◀️')
.setStyle(ButtonStyle.Primary);
this.nextButton = new ButtonBuilder()
.setCustomId('paginator_next')
.setLabel('▶️')
.setStyle(ButtonStyle.Primary);
this.row = new ActionRowBuilder().addComponents(
this.prevButton,
this.nextButton
);
}
async send(interaction) {
await interaction.reply({
content: this.pages[this.currentPage],
components: [this.row]
});
}
async handleInteraction(interaction) {
if (interaction.customId === 'paginator_prev') {
this.currentPage =
(this.currentPage - 1 + this.pages.length) % this.pages.length;
} else if (interaction.customId === 'paginator_next') {
this.currentPage =
(this.currentPage + 1) % this.pages.length;
}
await interaction.update({
content: this.pages[this.currentPage],
components: [this.row]
});
}
}
this is the class for the paging
Nov 23 22:03:20 aequitas node[1770632]: at handleErrors (/home/ubuntu/AequitasBot/aeq-bot/node_modules/@discordjs/rest/dist/index.js:748:13)
Nov 23 22:03:20 aequitas node[1770632]: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Nov 23 22:03:20 aequitas node[1770632]: at async BurstHandler.runRequest (/home/ubuntu/AequitasBot/aeq-bot/node_modules/@discordjs/rest/dist/i>
Nov 23 22:03:20 aequitas node[1770632]: at async _REST.request (/home/ubuntu/AequitasBot/aeq-bot/node_modules/@discordjs/rest/dist/index.js:12>
Nov 23 22:03:20 aequitas node[1770632]: at async ChatInputCommandInteraction.deferReply (/home/ubuntu/AequitasBot/aeq-bot/node_modules/discord>
Nov 23 22:03:20 aequitas node[1770632]: at async Object.execute (file:///home/ubuntu/AequitasBot/aeq-bot/commands/inactivity.js:11:9)
Nov 23 22:03:20 aequitas node[1770632]: at async Client.<anonymous> (file:///home/ubuntu/AequitasBot/aeq-bot/index.js:55:13) {
Nov 23 22:03:20 aequitas node[1770632]: requestBody: { files: undefined, json: { type: 5, data: [Object] } },
Nov 23 22:03:20 aequitas node[1770632]: rawError: { message: 'Unknown interaction', code: 10062 },
Nov 23 22:03:20 aequitas node[1770632]: code: 10062,
Nov 23 22:03:20 aequitas node[1770632]: status: 404,
Nov 23 22:03:20 aequitas node[1770632]: method: 'POST',
Nov 23 22:03:20 aequitas node[1770632]:
Nov 23 22:03:20 aequitas node[1770632]: }
Nov 23 22:03:20 aequitas node[1770632]: Uncaught Exception: DiscordAPIError[40060]: Interaction has already been acknowledged.```
Error I get
tag suggestion for @stoic marlin:
Common causes of DiscordAPIError[10062]: Unknown interaction:
- Initial response took more than 3 seconds ➞ defer the response *.
- Wrong interaction object inside a collector.
- Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance)
* Note: you cannot defer modal or autocomplete value responses