curious.dataclasses.role

Wrappers for Role objects.

Classes

Role(client, **kwargs) Represents a role on a server.
class curious.dataclasses.role.Role(client, **kwargs) → None[source]

Bases: curious.dataclasses.bases.Dataclass

Represents a role on a server.

Inspects the stack to ensure we’re being called correctly.

allow_mentions()[source]

Temporarily allows this role to be mentioned during.

async with role.allow_mentions():
    await ctx.channel.messages.send(role.mention)
Return type:_MentionableRole
await assign_to(member)[source]

Assigns this role to a member.

Parameters:member (Member) – The Member to assign to.
Return type:Role
await delete()[source]

Deletes this role.

Return type:Role
await edit(*, name=None, permissions=None, colour=None, position=None, hoist=None, mentionable=None)[source]

Edits this role.

Parameters:
  • name (Optional[str]) – The name of the role.
  • permissions (Optional[Permissions]) – The permissions that the role has.
  • colour (Optional[int]) – The colour of the role.
  • position (Optional[int]) – The position in the sorting list that the role has.
  • hoist (Optional[bool]) – Is this role hoisted (shows separately in the role list)?
  • mentionable (Optional[bool]) – Is this mentionable by everyone?
Return type:

Role

guild
Return type:Guild
Returns:The Guild associated with this role.
is_default_role
Return type:bool
Returns:If this role is the default role of the guild.
mention

Gets the string that can be used to mention this role.

Warning

If Role.mentionable is False, this will not actually mention the role.

Return type:str
await remove_from(member)[source]

Removes this role from a member.

Parameters:member (Member) – The Member to assign to.
snowflake_timestamp
Return type:datetime
Returns:The timestamp of the snowflake.
class curious.dataclasses.role._MentionableRole(r: curious.dataclasses.role.Role)[source]

Bases: object

A wrapper class that makes a role mentionable for a short time period.

async with role.allow_mentions():
    await ctx.channel.messages.send(role.mention)