discljord.permissions
Functions for determining users' permissions.
has-permission-flag?
(has-permission-flag? perm perms-int)
Returns if the given permission integer includes a permission flag.
`perm` is a keyword from the keys of [[permissions-bit]].
has-permission-flags?
(has-permission-flags? perms perms-int)
Returns if the given permission integer includes all the given permission flags.
`perm` is a keyword from the keys of [[permissions-bit]].
has-permission?
(has-permission? perm everyone roles)
(has-permission? perm guild user-id-or-member)
(has-permission? perm guild user-id-or-member channel-id)
(has-permission? perm everyone roles everyone-overrides roles-overrides user-overrides)
Returns if the given user has a permission.
`perm` is a keyword from the keys of [[permissions-bit]].
`everyone` is a permissions integer.
`roles` is a sequence of permissions integers.
`guild` is a guild object like those from [[discljord.events.state/prepare-guild]].
If not passed a guild object, the calling code will have to construct the list
of overrides and role permissions ints itself. See [[permission-int]] for
documentation of override objects.
has-permissions?
(has-permissions? perms everyone roles)
(has-permissions? perms guild user-id-or-member)
(has-permissions? perms guild user-id-or-member channel-id)
(has-permissions? perms everyone roles everyone-overrides roles-overrides user-overrides)
Returns if the given user has each of a sequence of permissions.
`perms` is a sequence of keywords from the keys of [[permissions-bit]].
`everyone` is a permissions integer.
`roles` is a sequence of permissions integers.
`guild` is a guild object like those from [[discljord.events.state/prepare-guild]].
If not passed a guild object, the calling code will have to construct the list
of overrides and role permissions ints itself. See [[permission-int]] for
documentation of override objects.
permission-flags
(permission-flags perms-int)
Returns a set of all permissions included in a given permission integer.
permission-int
(permission-int perms)
(permission-int everyone roles)
(permission-int everyone roles everyone-override roles-overrides user-override)
Constructs a permissions integer from role permissions integers and overrides or a sequence of permissions.
`perms` is a sequence or collection of permission names (keywords as defined in [[permissions-bit]]).
`everyone` is a permissions integer.
`roles` is a sequence of permissions integers.
Each of the override objects is an [overwrite object](https://discord.com/developers/docs/resources/channel#overwrite-object)
from their respective items (everyone, roles, and member overrides).
`roles-overrides` is a sequence of these objects.
permissions-bit
Map from permission names to the binary flag representation of it.
permissions-key
Map from binary flag representation to permission name.
user-roles
(user-roles guild user-id-or-member)
Returns a sequence of permissions integers for a user's roles.
`guild` is a guild object like those returned from
[[discljord.events.state/prepare-guild]] or stored in the state atom from
[[discljord.events.state/caching-middleware]].
This is primarily used to construct calls to [[permission-int]].