Paginated Message Bug

DiscordAPIError[40060]: Interaction has already been acknowledged.
at handleErrors (D:\bots\scully\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (D:\bots\scully\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (D:\bots\scully\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ButtonInteraction.update (D:\bots\scully\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:233:5)
at async safelyReplyToInteraction (D:\bots\scully\node_modules\@sapphire\discord.js-utilities\dist\cjs\index.cjs:675:7)
at async _PaginatedMessage.handleCollect (D:\bots\scully\node_modules\@sapphire\discord.js-utilities\dist\cjs\index.cjs:1741:11) {
requestBody: {
files: [],
json: {
type: 7,
data: {
content: 'This is the second page',
tts: false,
nonce: undefined,
embeds: [
{
title: undefined,
description: undefined,
url: undefined,
timestamp: '2024-03-08T02:49:43.491Z',
color: 16711680,
fields: undefined,
author: undefined,
thumbnail: undefined,
image: undefined,
video: undefined,
footer: [Object]
}
],
components: [
{ type: 1, components: [Array] },
{ 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
}
}
},
rawError: {
message: 'Interaction has already been acknowledged.',
code: 40060
},
code: 40060,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1215491616278716497/aW50ZXJhY3Rpb246MTIxNTQ5MTYxNjI3ODcxNjQ5Nzoxd1pNZjRJaWFKeHI0cElGR0NaMHlaNnBQSHB4aVhPZjRNTmIxUnh0eDBJNHdkb2lIODVadklJeENhV2hpRHBqSGdza1B5NlVWZEVLNkRkOU9sM2FuU1d1RFhSRFhpTmJic2g0WUp2eHRreG81alBCQmpyN1RLMzk1aWU2Qk9kWg/callback'
}
DiscordAPIError[40060]: Interaction has already been acknowledged.
at handleErrors (D:\bots\scully\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (D:\bots\scully\node_modules\@discordjs\rest\dist\index.js:826:23)
at async _REST.request (D:\bots\scully\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async ButtonInteraction.update (D:\bots\scully\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:233:5)
at async safelyReplyToInteraction (D:\bots\scully\node_modules\@sapphire\discord.js-utilities\dist\cjs\index.cjs:675:7)
at async _PaginatedMessage.handleCollect (D:\bots\scully\node_modules\@sapphire\discord.js-utilities\dist\cjs\index.cjs:1741:11) {
requestBody: {
files: [],
json: {
type: 7,
data: {
content: 'This is the second page',
tts: false,
nonce: undefined,
embeds: [
{
title: undefined,
description: undefined,
url: undefined,
timestamp: '2024-03-08T02:49:43.491Z',
color: 16711680,
fields: undefined,
author: undefined,
thumbnail: undefined,
image: undefined,
video: undefined,
footer: [Object]
}
],
components: [
{ type: 1, components: [Array] },
{ 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
}
}
},
rawError: {
message: 'Interaction has already been acknowledged.',
code: 40060
},
code: 40060,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1215491616278716497/aW50ZXJhY3Rpb246MTIxNTQ5MTYxNjI3ODcxNjQ5Nzoxd1pNZjRJaWFKeHI0cElGR0NaMHlaNnBQSHB4aVhPZjRNTmIxUnh0eDBJNHdkb2lIODVadklJeENhV2hpRHBqSGdza1B5NlVWZEVLNkRkOU9sM2FuU1d1RFhSRFhpTmJic2g0WUp2eHRreG81alBCQmpyN1RLMzk1aWU2Qk9kWg/callback'
}
Default paginated message code:
const { PaginatedMessage } = require('@sapphire/discord.js-utilities');
const { Command } = require('@sapphire/framework');
const { EmbedBuilder } = require('discord.js');
const { sendLoadingMessage } = require('../../lib/utils');

class UserCommand extends Command {
constructor(context, options) {
super(context, {
...options,
aliases: ['pm'],
description: 'A command that uses paginated messages.',
generateDashLessAliases: true
});
}

async messageRun(message) {
const response = await sendLoadingMessage(message);

const paginatedMessage = new PaginatedMessage({
template: new EmbedBuilder()
.setColor('#FF0000')
// Be sure to add a space so this is offset from the page numbers!
.setFooter({ text: ' footer after page numbers' })
});

paginatedMessage
.addPageEmbed((embed) =>
embed //
.setDescription('This is the first page')
.setTitle('Page 1')
)
.addPageBuilder((builder) =>
builder //
.setContent('This is the second page')
.setEmbeds([new EmbedBuilder().setTimestamp()])
);

await paginatedMessage.run(response, message.author);
return response;
}
}

module.exports = {
UserCommand
};
const { PaginatedMessage } = require('@sapphire/discord.js-utilities');
const { Command } = require('@sapphire/framework');
const { EmbedBuilder } = require('discord.js');
const { sendLoadingMessage } = require('../../lib/utils');

class UserCommand extends Command {
constructor(context, options) {
super(context, {
...options,
aliases: ['pm'],
description: 'A command that uses paginated messages.',
generateDashLessAliases: true
});
}

async messageRun(message) {
const response = await sendLoadingMessage(message);

const paginatedMessage = new PaginatedMessage({
template: new EmbedBuilder()
.setColor('#FF0000')
// Be sure to add a space so this is offset from the page numbers!
.setFooter({ text: ' footer after page numbers' })
});

paginatedMessage
.addPageEmbed((embed) =>
embed //
.setDescription('This is the first page')
.setTitle('Page 1')
)
.addPageBuilder((builder) =>
builder //
.setContent('This is the second page')
.setEmbeds([new EmbedBuilder().setTimestamp()])
);

await paginatedMessage.run(response, message.author);
return response;
}
}

module.exports = {
UserCommand
};
Solution:
could they have any interaction handlers that ended up having the same name as something in a paginated message component?
Jump to solution
12 Replies
KaydaFox
KaydaFox8mo ago
Have you tried just doing return paginatedMessage.run instead of return interaction havent used paginated messages in a while but that's all i used to return when i used it last oh nvm, i looked in the example repo and they did it the same way as you
./Ticker
./Ticker8mo ago
This is the default one, I didn't intend on using it but it's like that like that from the CLI
Favna
Favna8mo ago
To be more specific this happens when clicking the next page button I honestly have no idea :\
Solution
KaydaFox
KaydaFox8mo ago
could they have any interaction handlers that ended up having the same name as something in a paginated message component?
KaydaFox
KaydaFox8mo ago
its pretty unlikely but or maybe even ended up with another instance of the bot running
Favna
Favna8mo ago
Those could both be possibilities. Maybe they have a general interaction handler where they already acknowledge the button press. @./Ticker
./Ticker
./Ticker8mo ago
Yes?
Favna
Favna8mo ago
Have you looked at KaydaFox' suggestions?
./Ticker
./Ticker8mo ago
I did, I just reinstalled sapphire and it worked as usual IDK what happened
Favna
Favna8mo ago
:kekw:
./Ticker
./Ticker8mo ago
Putting his answer as the solution though Cause it is a good possibility
Favna
Favna8mo ago
Sure
Want results from more Discord servers?
Add your server