discord.js-pagination
discord.js-pagination copied to clipboard
Compatible with upcoming djs v13
- Added JSDoc Comments.
- Added condition
user.id === msg.author.id
in reaction filter so that no one other than message author will be able to navigate between pages. - Moved filter inside the options object to make it compatible with upcoming djs v13.
I'd say it's better to make the reaction collector filter a callback function that gets passed in rather than just a hardcoded conditional.
Have an optional parameter with a default:
reactionFilter = (reaction, user, emojiList, msg) => emojiList.includes(reaction.emoji.name)
&& !user.bot
&& user.id === msg.author.id
And then just:
filter: (reaction, user) => reactionFilter(reaction, user, emojiList, msg),
time: timeout
I've made a lot of things configurable / customizable in my PR you may wish to adapt.
You'll also need to update the message send and edit calls:
message.channel.send({ embeds: [embed] });
message.edit({ embeds: [embed] });
I've made these changes in my PR above.
I have also made my version of the package available on npm via npm install @psibean/discord.js-pagination
You should replace the reactions instead with buttons the user can click to move to another embed instead.
You should replace the reactions instead with buttons the user can click to move to another embed instead.
Using the new buttons is a good idea, I just made some quick changes to make it compatible and working as is.
I do not believe buttons should replace the ability to use reactions, some people may still want that.
I'll explore incorporating both, but potentially my version of the package will get refactored into clases and allow for a ReactionPaginationEmbed and a ButtonPaginationEmbed - this would be a major update (3.0.0)
https://github.com/DiabolusGX/djs-buttons-pagination
@hackermondev Here is something I made if you want buttons instead of reactions.