-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
breaking: Updated dpp::role comparison operators to now consider role IDs #1333
Conversation
…lid_argument when roles of two different guilds
✅ Deploy Preview for dpp-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
where in the docs is this behaviour of identical numeric values? as you can't set these values via the client, how could this happen in the first place? either way this is a breaking change that should be labelled as such imho |
it's not documented.
The only thing i know about is when you add bots to the server. Their roles always have a position of 1. |
im curious what discord's own opinion on this undocumented behaviour is, and if it should be supported, documented, or fixed on their end. I'll ask before we merge this in (or not!) and then we can proceed :) |
seems it is documented: https://discord.com/developers/docs/topics/permissions#role-object-role-structure
Lets get this merged in then, but first: As such, the == operator isn't particularly relevant here but should be preserved as it is used for sorting, finding and hashing if you store roles in a set etc, you may want to compare the role against a copy of that same role. As such we should fix == to work properly (returns true if id and position are the same in both objects) This also means less than cant just be "not greater than" |
wouldn't it be enough to just compare the IDs, since a role is already unique by its ID in a set of roles? |
sounds reasonable to me |
This is a breaking change for anyone using the comparison operators of the
dpp::role
class!If two roles have the same position, their IDs are compared to find out which role is higher in the hierarchy. The higher the IDs are, the lower they are. Previously, only the position was compared.
Documentation: https://discord.com/developers/docs/topics/permissions#role-object-role-structure
Code change checklist