fixed permissions getter like channel::get_user_permissions #426
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The following permissions getters calculated the permissions wrong. Discord probably changed the permission hierarchy. However the methods didn't follow the correct permission hierarchy.
channel::get_user_permissions()
guild::base_permissions()
guild::permission_overwrites()
btw some of them didn't checked for null pointer.
I also added the same getters with
guild_member
param and references instead of pointers, because the don't require the user cache then.Im wondering why the old ones got the
user
param, as they're immediately searching for the guild member in cache and doesn't really need the user.They all still requires the role cache as they go through the roles etc.
I also updated some comments in this pr :)
The whole thing is tested of course.
Additional Content
https://discord.com/developers/docs/topics/permissions#permission-overwrites