-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Full V13 support: Interactions (buttons and select menus) and reactions! #17
base: master
Are you sure you want to change the base?
Conversation
…arguments into an options object.
…tom filter only if it exists.
If you do something like this with this code:
If you click the x to delete the message and also click an arrow before the message is deleted, there's a race condition on Edit: This is a discord.js race condition issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an initial sweep of the PR, since I got the notification from the issue that one was created.
Thanks for the feedback, completely agree with all points. I’ll get back into it and resolve / reply more specifically once I’m done with work! |
In my previously presented example,
this line still throws an unknown message error if you hit a delete option then react another before the message is deleted. Since this is happening in the collect event, it's not something you can catch. I discussed the But it does mean there is still potential for errors to be thrown from the reaction removal in a case where collected reactions are sent shortly after a manual message delete is made, but before the message_deleted gateway response has come back for the message to be marked as deleted and fire the messages deleted event. Alternatively, I could pass the user to the pageResolver and handle the removal there, then people can also provide their custom logic and error handling around that. |
I think the best thing regarding reaction removal would be to just add a await reaction.users.remove(user.id).catch(() => {}); Or otherwise allow it to propagate and let the user handle it themselves. I've thought about proposing a throttle for message editing, so that deleting a message via a reaction and then immediately trying to react should not cause an edit to happen from the time the message is deleted to the time the reaction collector catches up and automatically ends, but this doesn't solve the problem of trying to react immediately after the message was deleted through other means (e.g. manually by another user). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome Upgrade. Loved it.
This is not working for me. First, if I include Second, this is all of the code: https://sourceb.in/W6WKao4Cvk |
Apologies if formatting here isn't quite right, I'm on mobile.
This error means that the actual variable emojiList, which you're passing into the function does not exist where you're using it. This is to do with variable scope. Example:
Make sure whatever you pass to the paginationEmbed function is actually within scope of the call.
This ones a bit trickier. My initial glance at the code, nothing jumps out. From what I can see, you should have at least 10 valid pages. Does this happen right away, or after navigating? The error indicates that your array has a blank / empty embed, or a null/undefined value Happy to help over discord! Also please be aware this version does not yet work with djs v13 which was just released. If you're using djs b13 this WILL be a problem. I will update it to v13 in a few hours! I may also publish this version to npm to make it easier for people to use |
Ah, yeah, I'm using DJS V13. My discord is DudeThatsErin#8061 whenever you get this working with v13, please shoot me a message. I would definitely appreciate it. Appreciate the fast response as well. |
I have since updated this as per the discordjs Updating from v12 to v13 guide. I have also added you on discord, please let me know if there are any issues with the updates, I'll be happy to continue support and maintenance! I have also published my version of the package to npm. You can now install and use via:
Edit: Had not yet pushed the v13 changes into the branch for this PR - they're in now. For those interested, the changes in v13 that impact this package are:
become
respectively, and for the message#createReactionCollector call, the reaction collector filter callback gets passed in as filter in the options. On this PR I bumped the version to 2.0.0 as it's no longer backwards compatible. If you want this version of the code which is still compatible with discordjs v12, use |
There were some additional issues found, they have now been fixed and this has been tested with discord.js v13 working as of v2.0.8. The paginationEmbed can take either a message or an interaction. (only used to access The fixes were also ported to the discord.js v12 version of the package which is now working at v1.1.1 |
I'm in the process of updating this to be class based and to support MessageComponents (buttons and select menus).
Each pagination also uses the received interaction/messages id (from the command initiating the pagination) as a suffix. This way in each paginations collectorFilter you can do:
This allows all of the event listeners to easily react to only the interactions they need. WIP: psibean#1 The PR branch contains a WORKING example too, I also plan on fully documenting once it's ready. |
I've abandoned the PR at this point. Find the new version over here. Complete support for reaction, button and select menu pagination. Fully customizable and controllable. |
saanuregh/discord.js-pagination#17 Full V13 support: Interactions (buttons and select menus) and reactions! #17
saanuregh/discord.js-pagination#17 Full V13 support: Interactions (buttons and select menus) and reactions! #17
saanuregh/discord.js-pagination#17 Full V13 support: Interactions (buttons and select menus) and reactions! #17
saanuregh/discord.js-pagination#17 Full V13 support: Interactions (buttons and select menus) and reactions! #17
saanuregh/discord.js-pagination#17 Full V13 support: Interactions (buttons and select menus) and reactions! #17
I have effectively abandoned this PR and released my own, full v13 compatible version.
Find it here with it's documentation and a working example bot.
Install with