Permission System
Osmium uses a bitwise permission system where each permission is represented by a bit flag. Permissions can be combined using bitwise OR operations.Permission Flags
All available community permissions from theCommunityPermission enum:
No permissions granted
Full administrative access, bypasses all permission checks. Users with this permission can perform any action.
Ability to view and read channels. Without this permission, channels are hidden.
Ability to send messages in text channels
Ability to connect to voice channels
Ability to edit channel settings, create new channels, and delete channels
Ability to send media attachments (images, videos, files) in messages
Ability to delete messages sent by other users
Ability to pin and unpin messages in channels
Ability to speak/transmit audio in voice channels
Ability to edit community settings (name, photo, etc.)
Ability to create, edit, and delete roles, and assign roles to members
Ability to ban/remove members from the community
Computing Permissions
Permissions are stored as 64-bit integers. To combine permissions:Roles
Roles are groups with specific permissions that can be assigned to members. Each role has:Role Structure
Snowflake ID of the role
Snowflake ID of the community this role belongs to
The name of the role
Bitwise permission flags granted to this role
Role priority/hierarchy. Higher values = higher priority. Used to determine which role’s color/permissions take precedence.
RGB color for this role (displayed next to member names)
Whether members with this role are displayed separately in the member list
Whether this role is publicly assignable or admin-only
Get Roles
Retrieve all roles in a community. Method:communities.getRoles
Request: GetRoles
Snowflake ID of the community
CommunityRoles
List of all roles in the community
The default permission flags granted to all members (even without roles)
Create Role
Create a new role in a community. Method:communities.createRole
Request: CreateRole
Snowflake ID of the community
Name for the new role
Bitwise permission flags to grant to this role
Priority/hierarchy level for this role
RGB color for this role
Whether to display members with this role separately
Whether this role is publicly assignable
Edit Role
Modify an existing role’s properties. Method:communities.editRole
Request: EditRole
Snowflake ID of the role to edit
Snowflake ID of the community
New name for the role
New permission flags for the role
New priority level
New color
New separated setting
New public setting
Delete Role
Permanently delete a role from a community. Method:communities.deleteRole
Request: DeleteRole
Snowflake ID of the role to delete
Snowflake ID of the community
Edit Default Permissions
Modify the default permissions granted to all members (regardless of roles). Method:communities.editDefaultPermissions
Request: EditDefaultPermissions
Snowflake ID of the community
New default permission flags
Permission Overrides
Channels can have role-specific permission overrides that allow or deny permissions independent of the role’s base permissions.PermissionOverrides Structure
Bitwise flags for permissions to explicitly allow/grant
Bitwise flags for permissions to explicitly deny/revoke
- Deny overrides (neg)
- Allow overrides (pos)
- Role permissions
- Default permissions
Get Channel Overrides
Retrieve all permission overrides for a specific channel. Method:communities.getChannelOverrides
Request: GetChannelOverrides
Snowflake ID of the community
Snowflake ID of the channel
ChannelOverrides
List of all permission overrides for this channel
Create Channel Override
Create a new permission override for a role in a specific channel. Method:communities.createChannelOverride
Request: CreateChannelOverride
Snowflake ID of the community
Snowflake ID of the channel
Snowflake ID of the role
The permission overrides to apply (pos for allows, neg for denies)
Delete Channel Override
Remove a permission override from a channel. Method:communities.deleteChannelOverride
Request: DeleteChannelOverride
Snowflake ID of the community
Snowflake ID of the channel
Snowflake ID of the role whose override should be removed