discord.js-pagination icon indicating copy to clipboard operation
discord.js-pagination copied to clipboard

Compatible with upcoming djs v13

Open DiabolusGX opened this issue 3 years ago • 4 comments

  • 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.

DiabolusGX avatar Jun 29 '21 20:06 DiabolusGX

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

psibean avatar Jul 21 '21 05:07 psibean

You should replace the reactions instead with buttons the user can click to move to another embed instead.

hackermondev avatar Aug 11 '21 23:08 hackermondev

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)

psibean avatar Aug 12 '21 02:08 psibean

https://github.com/DiabolusGX/djs-buttons-pagination

@hackermondev Here is something I made if you want buttons instead of reactions.

DiabolusGX avatar Aug 12 '21 06:08 DiabolusGX