glyde/payload/role
Bodies for the endpoints under /guilds/{g}/roles.
Types
POST /guilds/{g}/roles. Every field is optional and Discord supplies
defaults: a role created without a name is called “new role”.
pub type CreateRole {
CreateRole(
name: option.Option(String),
permissions: option.Option(permissions.Permissions),
color: option.Option(RoleColor),
hoist: option.Option(Bool),
badge: option.Option(RoleBadge),
mentionable: option.Option(Bool),
)
}
Constructors
-
CreateRole( name: option.Option(String), permissions: option.Option(permissions.Permissions), color: option.Option(RoleColor), hoist: option.Option(Bool), badge: option.Option(RoleBadge), mentionable: option.Option(Bool), )Arguments
- name
-
Max 100 characters.
- hoist
-
Show the role’s members in their own section of the member list.
PATCH /guilds/{g}/roles/{r}. Only the badge accepts null, whatever the
reference page says, so only it takes a Field.
pub type EditRole {
EditRole(
name: option.Option(String),
permissions: option.Option(permissions.Permissions),
color: option.Option(RoleColor),
hoist: option.Option(Bool),
badge: field.Field(RoleBadge),
mentionable: option.Option(Bool),
)
}
Constructors
-
EditRole( name: option.Option(String), permissions: option.Option(permissions.Permissions), color: option.Option(RoleColor), hoist: option.Option(Bool), badge: field.Field(RoleBadge), mentionable: option.Option(Bool), )Arguments
- badge
-
Nullleaves the role with no icon and no emoji.
A role wears an icon or an emoji, never both. An edit setting either one writes an explicit null over the other, so the body says what it wants rather than leaning on Discord to clear the loser.
pub type RoleBadge {
RoleIcon(image.ImageData)
RoleEmoji(String)
}
Constructors
-
RoleIcon(image.ImageData)Needs the ROLE_ICONS guild feature.
-
RoleEmoji(String)
Discord takes the role’s colour two ways and reads only one of them, so stating it twice is a body that contradicts itself. One value, one key.
pub type RoleColor {
LegacyColor(Int)
Colors(role.RoleColors)
}
Constructors
-
LegacyColor(Int)The deprecated
colorinteger, and still the only colour a guild without ENHANCED_ROLE_COLORS can set. -
Colors(role.RoleColors)The
colorsobject that supersedes it.
Values
pub fn create_role() -> CreateRole
pub fn create_role_body(payload: CreateRole) -> body.Body