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

Easy server member permission checking #150

Open
Macintosh-Fan opened this issue Jul 1, 2023 · 1 comment
Open

Easy server member permission checking #150

Macintosh-Fan opened this issue Jul 1, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Macintosh-Fan
Copy link

Describe the feature

Check to see if server member has a permission of some sort.

u64bitmask discord_get_member_permissions(const struct discord_guild_member* member) {
    u64bitmask permissions = 0;
    for (int i = 0; i < member->roles->size; ++i) {
        permissions |= member->roles->array[i].permissions;
    }
    return permissions;
}

Though, maybe a function like bool discord_member_has_permission(const struct discord_guild_member* member, unsigned int code) (maybe unsigned int should be something else) could also be implemented.

Additional context

Discord chat (credit goes to @lcsmuller).

@Macintosh-Fan Macintosh-Fan added the enhancement New feature or request label Jul 1, 2023
@ThePedroo
Copy link
Contributor

ThePedroo commented Jul 1, 2023

I'm not sure where this would be used, since for that you would need the discord_guild_member, which in at least all Discord API responses I know, has permissions field available.
As for the messages in #concord-help, it seems like there was a misunderstanding, since the MESSAGE_CREATE event doesn't include a member field

Edit: Nevermind, but Discord's get guild member only returns the IDs of the roles, you'll need to get them fetched, so in my opinion, we should find another approach to get the permissions

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

No branches or pull requests

2 participants