ClientCompoundRoleEndpoints

Methods

__new__()

Compound components do not support instancing.

Sub-typing is supported, but the attributes are only proxied. Sub-types have no meaning by themselves.

Raises

RuntimeError

guild_role_get_all(guild)

Requests the given guild's roles and if there any de-sync between the wrapper and Discord, applies the changes.

This method is a coroutine.

ParameterTypeDescription
guild

Guild, int

The guild, what's roles will be requested.

Returns

roles : list of Role

Raises

TypeError

If guild was not given neither as Guild, nor as int.

ConnectionError

No internet connection.

DiscordException

If any exception was received from the Discord API.

guild_sync()

role_create(guild, ...)

Creates a role at the given guild.

This method is a coroutine.

ParameterTypeOptionalKeyword onlyDefaultDescription
guild

Guild, int

The guild where the role will be created.

role_template

None, Role

None

Role entity to use as a template.

reason

None, str

None

Shows up at the guild's audit logs.

**keyword_parameters

Keyword parameters

Additional keyword parameters to create the role with.

color

Color, int

The role's color.

flags

RoleFlag, int

The role's flags.

icon

None, Icon, str, bytes-like

The role's icon.

mentionable

bool

Whether the role can be mentioned.

name

str

The role's name.

permissions

int, Permission

The permissions of the users having the role.

position

int

The role's position.

separated

bool

Users show up in separated groups by their highest separated role.

unicode_emoji

None, Emoji

The role's icon as an unicode emoji.

Raises

TypeError

  • If a parameter's type is incorrect.

ValueError

  • If a parameter's value is incorrect.

ConnectionError

No internet connection.

DiscordException

If any exception was received from the Discord API.

role_delete(role, ...)

Deletes the given role.

This method is a coroutine.

ParameterTypeOptionalKeyword onlyDefaultDescription
role

Role, tuple(int, int)

The role to delete

reason

None, str

None

Shows up at the respective guild's audit logs.

Raises

TypeError

If role was not given neither as Role nor as tuple of (int, int).

ConnectionError

No internet connection.

DiscordException

If any exception was received from the Discord API.

role_edit(role, ...)

Edits the role with the given parameters.

This method is a coroutine.

ParameterTypeOptionalKeyword onlyDefaultDescription
role

Role, tuple(int, int)

The role to edit.

role_template

None, Role

None

Role entity to use as a template.

reason

None, str

None

Shows up at the guild's audit logs.

**keyword_parameters

Keyword parameters

Additional keyword parameters to edit the role with.

color

Color, int

The role's color.

flags

RoleFlag, int

The role's flags.

icon

None, Icon, str, bytes-like

The role's icon.

mentionable

bool

Whether the role can be mentioned.

name

str

The role's name.

permissions

int, Permission

The permissions of the users having the role.

position

int

The role's position.

separated

bool

Users show up in separated groups by their highest separated role.

unicode_emoji

None, Emoji

The role's icon as an unicode emoji.

Raises

TypeError

  • If a parameter's type is incorrect.

ValueError

  • If a parameter's value is incorrect.

ConnectionError

No internet connection.

DiscordException

If any exception was received from the Discord API.

role_move(role, position, ...)

Moves the given role.

This method is a coroutine.

ParameterTypeOptionalKeyword onlyDefaultDescription
role

Role, tuple of (int, int)

The role to move.

position

int

The position to move the given role.

reason

None, str

None

Shows up at the respective guild's audit logs.

Raises

TypeError

If role was not given neither as Role nor as tuple of (int, int).

ValueError

  • If default role would be moved.
  • If any role would be moved to position 0.

ConnectionError

No internet connection.

DiscordException

If any exception was received from the Discord API.

role_reorder(roles, ...)

Moves more roles at their guild to the specific positions.

Partial roles are ignored and if passed any, every role's position after it is reduced. If there are roles passed with different guilds, then ValueError will be raised. If there are roles passed with the same position, then their positions will be sorted out.

This method is a coroutine.

ParameterTypeOptionalKeyword onlyDefaultDescription
roles

(dict like or iterable) of tuple(Role or (tuple(int, int), int) items

A dict, list, set, tuple, which contains role-position items.

reason

None, str

None

Shows up at the respective guild's audit logs.

Raises

TypeError

If roles 's format is not any of the expected ones.

ValueError

  • If default role would be moved.
  • If any role would be moved to position 0.
  • If roles from more guilds are passed.

ConnectionError

No internet connection.

DiscordException

If any exception was received from the Discord API.

_role_reorder_roles_element_validator(item)

Validates a role-position pair.

This method is a coroutine.

ParameterTypeDescription
item

tuple(Role or (tuple(int, int ), int ) items or object

A dict, list, set, tuple, which contains role-position items.

Yields

item : None, tuple(Role, Guild, int)

Returns

role : Role

The validated role.

guild : None, Guild

The role's guild.

Raises

TypeError

If item has invalid format.

_role_reorder_roles_validator(roles)

Validates roles parameter of .role_reorder.

This method is an asynchronous generator.

ParameterTypeDescription
roles

(dict like or iterable) of tuple(Role or (tuple(int, int ), int) items

A dict, list, set, tuple, which contains role-position items.

Yields

item : None, tuple(Role, Guild, int)

Raises

TypeError

If roles 's format is not any of the expected ones.