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

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

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 color integer, and still the only colour a guild without ENHANCED_ROLE_COLORS can set.

  • Colors(role.RoleColors)

    The colors object that supersedes it.

Values

pub fn create_role() -> CreateRole
pub fn create_role_body(payload: CreateRole) -> body.Body
pub fn edit_role() -> EditRole
pub fn edit_role_body(payload: EditRole) -> body.Body
Search Document