-
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
Missing Manage Messages Permission #20
Comments
You may want to handle this on the command level, e.g. prevent the command if your bot doesn't have the required permissions for it to work. How you do this depends on whether you have your own command handler, something like commando, akairo, etc. it should not be implemented on this level. The reason remove reaction is required, is so the user doesn't have to click the react twice after the initial react in order for it to change pages. The |
Hey, what if we don't mind it? The menu works without the permissions. Where would we catch the unhandled error cause it's filling up my commamd prompt. Also a solution wouldn't be to just add a remove reaction listener if the bot doesn't have manage messages? It would fire the add reaction listener. |
The current state of the code does not allow you to catch the error. The current design is intended that you should be ensuring the permissions are available prior to creating the pagination embed. Check my PR for a much more flexible and customizable version. I'm considering publishing this on npm myself to make it easier for people to use. You can pass in an error handler which will catch and pass any errors thrown inside the collect listener onto you, to do what you want. The reaction collector is exposed to the error handler so if it's an odd case you can choose to stop the collector, or whatever. Edit: commenting this here I've realized that perhaps the reaction remove call should be handled in it's own try / catch in my version so that the remainder of the handler still runs thereafter. But perhaps not, generally it's best to ensure your bot has the permissions it needs for something to work before allowing that thing to go through. |
I just removed the remove reaction command and no problemo! Thanks though! |
The script should be able to handle if the bot does not have
MANAGE_MESSAGES
permissions. This is useful if the guild owner does not want the bot to haveMANAGE_MESSAGES
as opposed to requiring it just to remove reactionsThe text was updated successfully, but these errors were encountered: