commands.color_role_commands module
- commands.color_role_commands.is_valid_hex_color(hex_color)[source]
Validate if a string is a valid hex color code.
- commands.color_role_commands.hex_to_discord_color(hex_color)[source]
Convert hex color string to Discord Color object.
- Parameters:
hex_color (
str
) – Hex color string (with or without # prefix)- Returns:
Discord color object
- Return type:
discord.Color
- commands.color_role_commands.find_existing_color_role(guild, hex_color)[source]
Find an existing role with the same hex color name.
- Parameters:
- Returns:
Existing role if found, None otherwise
- Return type:
discord.Role | None
- async commands.color_role_commands.get_lowest_position(_guild)[source]
Get the lowest position for placing color roles at the bottom of hierarchy.
- Parameters:
guild – Discord guild
- Returns:
Position for new color role (just above @everyone)
- Return type:
- async commands.color_role_commands.create_color_role(guild, hex_color, _bot_member)[source]
Create a new color role with the specified hex color.
- Parameters:
- Returns:
The created role
- Return type:
- Raises:
discord.Forbidden – If bot lacks permissions
discord.HTTPException – If role creation fails
- async commands.color_role_commands.remove_existing_color_roles(member)[source]
Remove all existing color roles from a member.
- async commands.color_role_commands.validate_color_role_request(interaction, hex_color)[source]
Validate a color role request.
- Parameters:
interaction (
Interaction
) – Discord interactionhex_color (
str
) – Hex color string to validate
- Returns:
(is_valid, error_message)
- Return type:
- async commands.color_role_commands.get_assignable_roles_from_db(guild_id)[source]
Get assignable roles from the Django database.
- async commands.color_role_commands.assignable_role_autocomplete(interaction, current)[source]
Autocomplete function for assignable role names.
- commands.color_role_commands.setup_basic_color_commands(bot)[source]
Set up basic color role commands (role, remove_role).
- async commands.color_role_commands.assign_server_role(interaction, role_id)[source]
Handle assignable role assignment logic.
- async commands.color_role_commands.assign_hex_color_role(interaction, hex_color, bot)[source]
Handle hex color role assignment logic.
- commands.color_role_commands.setup_remove_role_command(bot)[source]
Set up the remove_role command.
- async commands.color_role_commands.remove_specific_role(interaction, role_id)[source]
Handle removal of a specific assignable role.
- async commands.color_role_commands.remove_color_roles(interaction)[source]
Handle removal of color roles.
- commands.color_role_commands.setup_assign_role_command(bot)[source]
Set up the assign_role command.