Role Models#

class interactions.api.models.role.Role(kwargs_dict=None, /, **other_kwargs)[स्रोत]#

A class object representing a role.

चर पद :
  • id (Snowflake) -- Role ID

  • name (str) -- Role name

  • color (int) -- Role color in integer representation

  • hoist (bool) -- A status denoting if this role is hoisted

  • icon (Optional[str]) -- Role icon hash, if any.

  • unicode_emoji (Optional[str]) -- Role unicode emoji

  • position (int) -- Role position

  • permissions (Permissions) -- Role permissions as a bit set

  • managed (bool) -- A status denoting if this role is managed by an integration

  • mentionable (bool) -- A status denoting if this role is mentionable

  • tags (Optional[RoleTags]) -- The tags this role has

property mention: str#

संस्करण 4.1.0 से नया .

Returns a string that allows you to mention the given role.

प्रदत्त :

The string of the mentioned role.

प्रदत्त प्रकार :

str

property created_at: datetime#

संस्करण 4.4.0 से नया .

Returns when the role was created.

async delete(guild_id, reason=None)[स्रोत]#

संस्करण 4.0.2 से नया .

Deletes the role from the guild.

मापदण्ड:
  • guild_id (int) -- The id of the guild to delete the role from

  • reason (Optional[str]) -- The reason for the deletion

async modify(guild_id, name=<interactions.MISSING>, permissions=<interactions.MISSING>, color=<interactions.MISSING>, hoist=<interactions.MISSING>, icon=<interactions.MISSING>, unicode_emoji=<interactions.MISSING>, mentionable=<interactions.MISSING>, reason=None)[स्रोत]#

संस्करण 4.0.2 से नया .

Edits the role in a guild.

मापदण्ड:
  • guild_id (int) -- The id of the guild to edit the role on

  • name (Optional[str]) -- The name of the role, defaults to the current value of the role

  • color (Optional[int]) -- RGB color value as integer, defaults to the current value of the role

  • permissions (Optional[Union[Permissions, int]]) -- Bitwise value of the enabled/disabled permissions, defaults to the current value of the role

  • hoist (Optional[bool]) -- Whether the role should be displayed separately in the sidebar, defaults to the current value of the role

  • icon (Optional[Image]) -- The role's icon image (if the guild has the ROLE_ICONS feature), defaults to the current value of the role

  • unicode_emoji (Optional[str]) -- The role's unicode emoji as a standard emoji (if the guild has the ROLE_ICONS feature), defaults to the current value of the role

  • mentionable (Optional[bool]) -- Whether the role should be mentionable, defaults to the current value of the role

  • reason (Optional[str]) -- The reason why the role is edited, default None

प्रदत्त :

The modified role object

प्रदत्त प्रकार :

Role

async modify_position(guild_id, position, reason=None)[स्रोत]#

संस्करण 4.0.2 से नया .

Modifies the position of a role in the guild.

मापदण्ड:
  • guild_id (int) -- The id of the guild to modify the role position on

  • position (int) -- The new position of the role

  • reason (Optional[str]) -- The reason for the modifying

प्रदत्त :

List of guild roles with updated hierarchy

प्रदत्त प्रकार :

List[Role]

class interactions.api.models.role.RoleTags(kwargs_dict=None, /, **other_kwargs)[स्रोत]#

A class object representing the tags of a role.

टिप्पणी

With the premium_subscriber and available_for_purchase attributes currently, if the attribute is present and "null" it's true, and if the attribute is not present it's false.

चर पद :
  • bot_id (Optional[Snowflake]) -- The id of the bot this role belongs to

  • integration_id (Optional[Snowflake]) -- The id of the integration this role belongs to

  • premium_subscriber (Optional[bool]) -- Whether if this is the guild's booster role.

  • subscription_listing_id (Optional[Snowflake]) -- The id of this role's subscription sku and listing, if any.

  • available_for_purchase (Optional[bool]) -- Whether this role is available for purchase.