sidequest_bot.lib.roles#

Rules for roles the bot hands out on its own (level rewards, auto-role, self-serve role menus).

Two independent checks, both required:

  • grant_block_reason() - is the role itself safe for the bot to give away? Checked when the role is configured AND again right before every grant, because an admin can add permissions to a role after it was configured.

  • configure_block_reason() - may this member set the role up to be handed out? Without it, anyone with Manage Server could configure a role above their own and escalate through the bot’s permissions.

Attributes#

DANGEROUS_PERMISSIONS

Permissions a role must not carry if the bot grants it automatically or on request.

Functions#

configure_block_reason(→ str | None)

Why member may not configure role to be handed out by the bot, or None if they may.

dangerous_permissions(→ list[str])

Names of the dangerous permissions set in permissions, sorted.

grant_block_reason(→ str | None)

Why the bot must not hand out role automatically, or None if it may.

Module Contents#

sidequest_bot.lib.roles.configure_block_reason(member: discord.Member, role: discord.Role) → str | None#

Why member may not configure role to be handed out by the bot, or None if they may.

Requires Manage Roles and that the role sits below the member’s highest role (the server owner is exempt).

sidequest_bot.lib.roles.dangerous_permissions(permissions: discord.Permissions) → list[str]#

Names of the dangerous permissions set in permissions, sorted.

sidequest_bot.lib.roles.grant_block_reason(role: discord.Role) → str | None#

Why the bot must not hand out role automatically, or None if it may.

sidequest_bot.lib.roles.DANGEROUS_PERMISSIONS#

Permissions a role must not carry if the bot grants it automatically or on request.