Skip to content
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

Open
hrrstuart opened this issue Feb 7, 2021 · 4 comments
Open

Missing Manage Messages Permission #20

hrrstuart opened this issue Feb 7, 2021 · 4 comments

Comments

@hrrstuart
Copy link

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 have MANAGE_MESSAGES as opposed to requiring it just to remove reactions

@psibean
Copy link

psibean commented Feb 10, 2021

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 collect event is fired for a new reaction, not a removed one. If the bot doesn't do it, then the user will have to un-react, then react again for a change.

@xMyThoLoGyx
Copy link

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 collect event is fired for a new reaction, not a removed one. If the bot doesn't do it, then the user will have to un-react, then react again for a change.

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.

@psibean
Copy link

psibean commented Apr 22, 2021

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 collect event is fired for a new reaction, not a removed one. If the bot doesn't do it, then the user will have to un-react, then react again for a change.

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.

@xMyThoLoGyx
Copy link

I just removed the remove reaction command and no problemo! Thanks though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants