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

Discord Channel Permissions Inconsistencies #414

Open
schnapster opened this issue Jul 27, 2017 · 8 comments
Open

Discord Channel Permissions Inconsistencies #414

schnapster opened this issue Jul 27, 2017 · 8 comments
Labels
status: completed has been completed but is not yet released type: discord issue seems to be an issue on discord's end

Comments

@schnapster
Copy link
Contributor

I'm getting a lot of these:

net.dv8tion.jda.core.exceptions.ErrorResponseException: 50013: Missing Permissions
    at net.dv8tion.jda.core.exceptions.ErrorResponseException.create(ErrorResponseException.java:145)
    at net.dv8tion.jda.core.requests.Request.onFailure(Request.java:83)
    at net.dv8tion.jda.core.entities.impl.TextChannelImpl$4.handleResponse(TextChannelImpl.java:360)
    at net.dv8tion.jda.core.requests.Request.handleResponse(Request.java:166)
    at net.dv8tion.jda.core.requests.Requester.execute(Requester.java:186)
    at net.dv8tion.jda.core.requests.Requester.execute(Requester.java:86)
    at net.dv8tion.jda.core.requests.ratelimit.BotRateLimiter$Bucket.run(BotRateLimiter.java:310)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)

To reproduce:
Give the bot the "Manage Roles" permission, and try to do something like clearing Emojis from a message.
The problem here is, that I can't even check this in front of, because JDA will tell me that yes, it does have permissions to Manage Messages only to then error out when queue()ing that action.
@MinnDevelopment explained it to me like this:

MANAGE_ROLES = MANAGE_PERMISSIONS
MANAGE_PERMISSIONS -> ALL_TEXT_PERMISSIONS
ALL_TEXT_PERMISSIONS -> MANAGE_MESSAGE

and that this was an inconsistency in handling permissions on Discords side.

So how can I know in this case in advance that I am missing a permission?

@MinnDevelopment
Copy link
Member

You can get permissions without the special cases by using PermissionUtil.getExplicitPermissions(...)

@schnapster
Copy link
Contributor Author

Thanks, I shall use that then. Wasn't aware this was in JDA since I never really looked at PermissionUtil due to it being a JDA internal class. Guess these methods aren't about to change significantly?

@MinnDevelopment
Copy link
Member

PermissionUtil will likely not be updated until a new permission change is made by discord. This is likely to happen with the release of channel categories.

@MinnDevelopment
Copy link
Member

Since we've been waiting half a year for a change in channel permissions, I updated the handling for now to properly respect the current (bad) channel permission system.
This is available in build 333 and will be in the next release unless something in the permissions on discord's end changes first (who am I kidding).

This issue will stay open to keep track of this problem as it is still an issue on discord's end which needs to be fixed.

@MinnDevelopment MinnDevelopment added the status: completed has been completed but is not yet released label Feb 2, 2018
@MinnDevelopment
Copy link
Member

This has been resolved in release 3.5.1
I will keep this issue open until discord fixes their permissions

@MinnDevelopment MinnDevelopment changed the title 50013: Missing Permissions due to cascading permissions Discord Channel Permissions Inconsistencies Feb 14, 2018
@discord-jda discord-jda deleted a comment from Codixer Jun 3, 2021
@CanIGetaPR
Copy link

CanIGetaPR commented Jun 13, 2021

This can be closed now, Discord fixed the permission leak by not allowing users with manage roles to grant permissions they don't already possess.

Example: Screenshot of trying to edit a role's permissions while using a role with only manage roles permission activated. (And some basic permissions inherited from @everyone)

image

@DV8FromTheWorld
Copy link
Member

If this is indeed the case then PermissionUtil will need to be re-evaluated to see if the situation has changed and if we need to modify our functionality to match the now-fixed functionality.

@V-Play-Games
Copy link
Contributor

I think this issue can now be closed, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: completed has been completed but is not yet released type: discord issue seems to be an issue on discord's end
Projects
None yet
Development

No branches or pull requests

5 participants