mewna / catnip

A reactive, fully-async Discord API wrapper for the JVM, built on RxJava 3.
https://discord.gg/yeF2HpP
BSD 3-Clause "New" or "Revised" License
151 stars 33 forks source link

Member Role add and Remove on Owner #512

Closed ModdyLP closed 3 years ago

ModdyLP commented 3 years ago

Hey,

why can the bot not interact with the server owner? For example, giving and revoking roles does not work on the server owner. Is there a cause for this decision.

Best Regards

queer commented 3 years ago

I'm pretty sure you're just running into the limitations of Discord's API and how permissions work.

ModdyLP commented 3 years ago

That was my first thought but i looked at the PermissionUtil in the canInteract Method which is called by checkHirarchy and there is a if block which is executed if the author is the owner. And that block returns false to the class.

queer commented 3 years ago

iirc this is because the owner is technically the highest role possible, and so iirc bots can't interact with them like that.

ModdyLP commented 3 years ago

Hey sorry for my late answer, i understand your point. I think the discord roles are more important than the owner role. Look at these:

How permissions apply may at first seem intuitive, but there are some hidden restrictions that prevent bots from performing certain inappropriate actions based on a bot's highest role compared to its target's highest role. A bot's or user's highest role is its role that has the greatest position value in the guild, with the default @everyone role starting at 0. Permissions follow a hierarchy with the following rules:
A bot can grant roles to other users that are of a lower position than its own highest role.
A bot can edit roles of a lower position than its highest role, but it can only grant permissions it has to those roles.
A bot can only sort roles lower than its highest role.
A bot can only kick, ban, and edit nicknames for users whose highest role is lower than the bot's highest role.
Otherwise, permissions do not obey the role hierarchy. For example, a user has two roles: A and B. A denies the VIEW_CHANNEL permission on a #coolstuff channel. B allows the VIEW_CHANNEL permission on the same #coolstuff channel. The user would ultimately be able to view the #coolstuff channel, regardless of the role positions. 

There is nothing mentioned like that, only that the order of the roles on the right side of discord make the permissions. So if i order the bot role above the highest role, so that the bot is the highest role, all stuff should be possible.

queer commented 3 years ago

If you attempt to do this via the raw REST methods, you will get a 50013 Missing Permissions REST error back from Discord. This is not a bug in catnip.