PaginatedMessage unknown interaction

Hi, so the idea is I have certain commands that use a paginated message, and I want to log the user's result to my logs channel to check if it's working correctly. I log command usage in a method like the code below, and I realise my app crashes very frequently with a DiscordAPIError[10062]: Unknown interaction, especially when i try to navigate the pages myself with the select menu. The node.js process then exits with error code 1. I suspect that the duplicate pagination (one to the user, one to the logs channel) is causing the issue, so I disabled the logging and I encounter no more crashes. I'd really like to fix this if possible though, and I can't seeem to pinpoint what went wrong. Any help appreciated. Thanks!
public static async logPagination(pagination: PaginatedMessage) {
const commandLogsChannel = CommandLogger._getCommandLogsChannel();
const msg = await commandLogsChannel.send({
embeds: [
new EmbedBuilder()
.setDescription("Running a paginated message here.")
]
});

const botOwner = container.owner.user;

return pagination.clone().run(msg, botOwner);
}
public static async logPagination(pagination: PaginatedMessage) {
const commandLogsChannel = CommandLogger._getCommandLogsChannel();
const msg = await commandLogsChannel.send({
embeds: [
new EmbedBuilder()
.setDescription("Running a paginated message here.")
]
});

const botOwner = container.owner.user;

return pagination.clone().run(msg, botOwner);
}
Edit: if it helps, this is how i invoke the method.
public override async chatInputRun(interaction: ChatInputCommandInteraction) {
/* here is the logic to generate paginatedMessage */

void CommandLogger.logPagination(paginatedMessage);
return paginatedMessage.run(interaction);
}
public override async chatInputRun(interaction: ChatInputCommandInteraction) {
/* here is the logic to generate paginatedMessage */

void CommandLogger.logPagination(paginatedMessage);
return paginatedMessage.run(interaction);
}
Solution:
This will never work. You cannot have 2 things on 1 interaction like that. Why log every action of the user and not just the errors though? Also the process shouldn't exit outright on a simple error. This suggests your error handling is borked. That's a different problem though....
Jump to solution
1 Reply
Solution
Favna
Favna3mo ago
This will never work. You cannot have 2 things on 1 interaction like that. Why log every action of the user and not just the errors though? Also the process shouldn't exit outright on a simple error. This suggests your error handling is borked. That's a different problem though.

Did you find this page helpful?