Skip to content

Role Model

Note

The following classes come from the scurrypy.models.role module.


RoleModel dataclass

Bases: DataModel

Represents a Discord role.

id: int instance-attribute

ID of the role.

name: str instance-attribute

Name of the role.

colors: RoleColorModel instance-attribute

Colors of the role.

hoist: bool instance-attribute

If the role is pinned in user listing.

position: int instance-attribute

Position of the role.

managed: bool instance-attribute

If the role is managed by an integration.

mentionable: bool instance-attribute

If the role is mentionable.

flags: int instance-attribute

Role flags combined as a bitfield.

icon: Optional[str] instance-attribute

Icon hash of the role.

permissions: str instance-attribute

permission bits set.

unicode_emoji: Optional[str] instance-attribute

Unicode emoji of the role.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss


RoleColorModel dataclass

Bases: DataModel

Represents role color data.

primary_color: int instance-attribute

Primary color of the role.

secondary_color: int instance-attribute

Secondary color of the role. Creates a gradient.

tertiary_color: int instance-attribute

Tertiary color of the role. Creates a holographic style.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss