collector.stop() throw's an error

hi, so i'm not really sure what's wrong here cuz everytime i press the stop button it just throws this error
/home/.../node_modules/.pnpm/@discordjs+rest@2.4.3/node_modules/@discordjs/rest/src/lib/handlers/Shared.ts:148
throw new DiscordAPIError(data, 'code' in data ? data.code : data.error, status, method, url, requestData);
^


DiscordAPIError[10062]: Unknown interaction
/home/.../node_modules/.pnpm/@discordjs+rest@2.4.3/node_modules/@discordjs/rest/src/lib/handlers/Shared.ts:148
throw new DiscordAPIError(data, 'code' in data ? data.code : data.error, status, method, url, requestData);
^


DiscordAPIError[10062]: Unknown interaction
this is my actions array
const actions: PaginatedMessageAction[] = [
...
{
customId: 'oreo/paginated.stop',
type: 2,
style: 1,
label: symbols.paginated.delete,
run: ({ collector }) => collector.stop()
}
];
const actions: PaginatedMessageAction[] = [
...
{
customId: 'oreo/paginated.stop',
type: 2,
style: 1,
label: symbols.paginated.delete,
run: ({ collector }) => collector.stop()
}
];
the rest of it goes like this
const paginated = new PaginatedMessage({
template: new EmbedBuilder().setColor(colors.WHITE),
pageIndexPrefix: 'Page',
actions: actions
}).setIdle(15000);

paginated.addPageEmbed(() => embed);
return await paginated.run(interaction);
const paginated = new PaginatedMessage({
template: new EmbedBuilder().setColor(colors.WHITE),
pageIndexPrefix: 'Page',
actions: actions
}).setIdle(15000);

paginated.addPageEmbed(() => embed);
return await paginated.run(interaction);
Solution:
If all you want is to add a label to the default stop button I would recommend you instead do ```ts import { partition } from '@sapphire/utilities'; const [stopActions, otherActions] = partition(PaginatedMessage.defaultActions, action => action.customId === '@sapphire/paginated-messages.stop');...
Jump to solution
9 Replies
Favna
Favna6mo ago
Have you per chance updated discordjs with the latest update? Might be that's why
cosmic
cosmicOP6mo ago
oh i just updated the packages now and it still gives me the error except now it doesn't even stop the collector previously it stopped the collector but the bot would crash with this error
Favna
Favna6mo ago
what is the reason you have the custom stop action btw? it's one of the default actions.
Favna
Favna6mo ago
https://favna.s-ul.eu/scrns/2beBhGqf.PNG those are the default actions (everything except for the link buttons)
Favna
Favna6mo ago
also are you sure that idle is correct? That's only 15 seconds. That's very short. The default idle is 14.5 which is just below the maximum interaction time to reply to discord (of 15 minutes)
Solution
Favna
Favna6mo ago
If all you want is to add a label to the default stop button I would recommend you instead do
import { partition } from '@sapphire/utilities';

const [stopActions, otherActions] = partition(PaginatedMessage.defaultActions, action => action.customId === '@sapphire/paginated-messages.stop');
const stopAction = stopActions.at(0);
stopAction.label = 'my label'


const paginated = new PaginatedMessage({...}).setActions([...otherActions, stopAction]
import { partition } from '@sapphire/utilities';

const [stopActions, otherActions] = partition(PaginatedMessage.defaultActions, action => action.customId === '@sapphire/paginated-messages.stop');
const stopAction = stopActions.at(0);
stopAction.label = 'my label'


const paginated = new PaginatedMessage({...}).setActions([...otherActions, stopAction]
Favna
Favna6mo ago
basically picking the stop action, modifying it, then setting it back.
Favna
Favna6mo ago
aaanyyaay I dont know why you get this problem exactly. I dont get it with @Dragonite. The code is open source so you can view all versions of dependencies and code here: https://github.com/favware/dragonite
GitHub
GitHub - favware/dragonite: A Pokémon information Discord bot buil...
A Pokémon information Discord bot built around Discord Interactions - favware/dragonite
cosmic
cosmicOP2mo ago
alright i'll check it out soon, got some exams right now so i'll keep this thread open if that's okay thank you forgot to reply, this worked great, thanks again

Did you find this page helpful?