Skip to content

Mentionable

Mentionable dataclass #

Mentionable(user: User | None, role: Role | None)

Represent's discord's mentionable type. A mentionable can be a User or Role. Not that it can not be both.

Example#
@client.include
@crescent.command
async def command(ctx: crescent.Context, mentionable: crescent.Mentionable):
    if mentionable.is_user:
        user = mentionable.unwrap_user()
    else:
        role = mentionable.unwrap_role()