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/@[email protected]/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/@[email protected]/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);
6 Replies
Favna
Favna3d ago
Have you per chance updated discordjs with the latest update? Might be that's why
cosmic
cosmicOP3d 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
Favna3d ago
what is the reason you have the custom stop action btw? it's one of the default actions.
Favna
Favna3d ago
https://favna.s-ul.eu/scrns/2beBhGqf.PNG those are the default actions (everything except for the link buttons)
Favna
Favna3d 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) 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]
basically picking the stop action, modifying it, then setting it back.
Favna
Favna3d 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

Did you find this page helpful?