Skip to content

config

Tux Configuration UI Package.

A modular, extensible configuration interface system using Discord Components V2. Provides a clean foundation for building configuration UIs with proper separation of concerns, reusable components, and type-safe interactions.

Modules:

  • callbacks

    Callback utilities for ConfigDashboard.

  • command_discovery

    Command discovery utilities for ConfigDashboard.

  • dashboard

    Unified configuration dashboard using the new UI framework.

  • helpers

    Helper utilities for config dashboard.

  • modals

    Modal dialogs for config dashboard.

  • pagination

    Pagination helpers for config dashboard modes.

  • ranks

    Rank management utilities for the config dashboard.

Classes:

  • ConfigDashboard

    Unified configuration dashboard using the new UI framework.

Classes

ConfigDashboard

Python
ConfigDashboard(bot: Tux, guild: Guild, author: User | Member, mode: str = 'overview')

Bases: LayoutView

Unified configuration dashboard using the new UI framework.

Provides a clean, modular interface that scales with new configuration options while maintaining proper component limits and user experience.

Classes:

  • RanksButton

    Button to open the Permission Ranks configuration mode.

  • RolesButton

    Button to open the Role Assignments configuration mode.

  • CommandsButton

    Button to open the Command Permissions configuration mode.

  • LogsButton

    Button to open the Log Channels configuration mode.

  • ResetButton

    Button to reset all configuration to defaults.

Methods:

Classes

RanksButton
Python
RanksButton()

Bases: Button[LayoutView]

Button to open the Permission Ranks configuration mode.

Methods:

  • callback

    Handle button click to switch to ranks mode.

Functions
callback async
Python
callback(interaction: Interaction) -> None

Handle button click to switch to ranks mode.

RolesButton
Python
RolesButton()

Bases: Button[LayoutView]

Button to open the Role Assignments configuration mode.

Methods:

  • callback

    Handle button click to switch to roles mode.

Functions
callback async
Python
callback(interaction: Interaction) -> None

Handle button click to switch to roles mode.

CommandsButton
Python
CommandsButton()

Bases: Button[LayoutView]

Button to open the Command Permissions configuration mode.

Methods:

  • callback

    Handle button click to switch to commands mode.

Functions
callback async
Python
callback(interaction: Interaction) -> None

Handle button click to switch to commands mode.

LogsButton
Python
LogsButton()

Bases: Button[LayoutView]

Button to open the Log Channels configuration mode.

Methods:

  • callback

    Handle button click to switch to logs mode.

Functions
callback async
Python
callback(interaction: Interaction) -> None

Handle button click to switch to logs mode.

ResetButton
Python
ResetButton()

Bases: Button[LayoutView]

Button to reset all configuration to defaults.

Methods:

  • callback

    Handle button click to reset configuration.

Functions
callback async
Python
callback(interaction: Interaction) -> None

Handle button click to reset configuration.

Functions

_get_cache_key
Python
_get_cache_key(mode: str) -> str

Generate cache key for a mode based on current pagination state.

Python
_build_pagination_footer(mode: str) -> TextDisplay[LayoutView]

Build pagination footer showing current page info.

Python
_build_pagination_info_footer(
    mode: str, start_idx: int, end_idx: int, total_items: int, item_name: str
) -> TextDisplay[LayoutView]

Build pagination info footer showing item range (e.g., 'Showing ranks 1-5 of 7').

_build_pagination_navigation
Python
_build_pagination_navigation(
    mode: str, rebuild_method: Callable[[], Awaitable[None]]
) -> ActionRow[LayoutView]

Build navigation buttons for pagination (generic helper).

_handle_page_change async
Python
_handle_page_change(
    interaction: Interaction, mode: str, rebuild_method: Callable[[], Awaitable[None]]
) -> None

Handle pagination button clicks (generic helper).

invalidate_cache
Python
invalidate_cache(mode: str | None = None) -> None

Invalidate cached components for performance optimization.

get_cached_mode
Python
get_cached_mode(mode: str) -> Container[LayoutView] | None

Get cached container for a mode if available.

cache_mode
Python
cache_mode(mode: str, container: Container[LayoutView]) -> None

Cache a built container for a mode.

build_layout async
Python
build_layout() -> None

Build the dashboard layout based on current mode.

_build_overview_mode
Python
_build_overview_mode() -> None

Build the overview/dashboard mode with a creative card-based layout.

build_ranks_mode async
Python
build_ranks_mode() -> None

Build the ranks management mode (create, delete, view ranks).

_group_assignments_by_rank
Python
_group_assignments_by_rank(
    ranks: list[Any], assignments: list[Any]
) -> dict[int, list[dict[str, Any]]]

Group role assignments by rank value.

_build_rank_assignment_display
Python
_build_rank_assignment_display(
    rank: Any, rank_assignments: list[dict[str, Any]]
) -> TextDisplay[LayoutView]

Build the display text for a rank with its assigned roles.

_build_rank_status_display
Python
_build_rank_status_display(
    rank_assignments: list[dict[str, Any]],
) -> TextDisplay[LayoutView]

Build the status display for a rank.

_build_role_selector
Python
_build_role_selector(
    rank: Any, rank_assignments: list[dict[str, Any]]
) -> RoleSelect[LayoutView] | None

Build a role selector for a rank.

build_roles_mode async
Python
build_roles_mode() -> None

Build the role-to-rank assignment mode.

_validate_rank_for_assignment async
Python
_validate_rank_for_assignment(rank_id: int) -> int | None

Validate rank exists and return its database ID.

_build_role_assignment_view
Python
_build_role_assignment_view(
    rank_id: int, role_select: RoleSelect[LayoutView]
) -> tuple[LayoutView, Container[LayoutView]]

Build the initial role assignment view.

update_role_selection_ui
Python
update_role_selection_ui(
    rank_id: int,
    selected_roles: list[Role],
    role_select: RoleSelect[LayoutView],
    assign_view: LayoutView,
    assign_container: Container[LayoutView],
    confirm_callback: Any,
    cancel_callback: Any,
) -> None

Update the role assignment UI with selected roles.

_handle_assign_role async
Python
_handle_assign_role(interaction: Interaction) -> None

Handle assigning a role to a rank using a modal.

_handle_confirm_assign_role async
Python
_handle_confirm_assign_role(interaction: Interaction) -> None

Handle confirming role assignment.

_handle_remove_role async
Python
_handle_remove_role(interaction: Interaction) -> None

Handle removing roles from a rank.

_find_role_select_from_message
Python
_find_role_select_from_message(message: Message, custom_id: str) -> list[Role] | None

Find a RoleSelect component from a message and return its selected values.

_handle_confirm_remove_role async
Python
_handle_confirm_remove_role(interaction: Interaction) -> None

Handle confirming role removal.

_handle_cancel_assign async
Python
_handle_cancel_assign(interaction: Interaction) -> None

Handle canceling role assignment/removal.

_build_command_display
Python
_build_command_display(
    cmd_name: str, rank_value: int | None, is_assigned: bool, rank_map: dict[int, Any]
) -> TextDisplay[LayoutView]

Build the display text for a command with its rank assignment.

_build_command_status_display
Python
_build_command_status_display(
    rank_value: int | None, is_assigned: bool, rank_map: dict[int, Any]
) -> TextDisplay[LayoutView]

Build the status display for a command.

_build_command_rank_selector
Python
_build_command_rank_selector(
    cmd_name: str, rank_value: int | None, is_assigned: bool, ranks: list[Any]
) -> Select[LayoutView]

Build a rank selector for a command.

build_commands_mode async
Python
build_commands_mode() -> None

Build the command permissions configuration mode.

_build_log_option_display
Python
_build_log_option_display(
    option: dict[str, str], current_channel: TextChannel | None
) -> TextDisplay[LayoutView]

Build the display text for a log option.

_build_log_status_display
Python
_build_log_status_display(
    current_channel: TextChannel | None,
) -> TextDisplay[LayoutView]

Build the status display for a log option.

_build_log_channel_selector
Python
_build_log_channel_selector(
    option: dict[str, str], current_channel: TextChannel | None
) -> ChannelSelect[LayoutView]

Build a channel selector for a log option.

build_logs_mode async
Python
build_logs_mode() -> None

Build logs configuration mode with improved organization.

find_channel_select_component
Python
find_channel_select_component(custom_id: str) -> ChannelSelect[LayoutView] | None

Find a ChannelSelect component by custom_id.

resolve_channel_from_interaction
Python
resolve_channel_from_interaction(
    channel_select: ChannelSelect[LayoutView], interaction: Interaction
) -> TextChannel | None

Resolve selected channel from component or interaction data.

update_channel_and_rebuild async
Python
update_channel_and_rebuild(
    option_key: str, channel_id: int | None, interaction: Interaction, message: str
) -> None

Update channel config and rebuild logs mode.

_save_channel_config async
Python
_save_channel_config(option_key: str, channel_id: int | None) -> None

Save channel configuration to database.

_build_error_mode
Python
_build_error_mode(error_message: str) -> None

Build an error display mode.

_handle_mode_change async
Python
_handle_mode_change(interaction: Interaction) -> None

Handle mode changes from overview buttons.

_handle_create_rank async
Python
_handle_create_rank(interaction: Interaction) -> None

Handle create rank button click - opens modal.

_handle_init_default_ranks async
Python
_handle_init_default_ranks(interaction: Interaction) -> None

Handle init default ranks button click - creates default ranks 0-7.

handle_back_to_overview async
Python
handle_back_to_overview(interaction: Interaction) -> None

Handle back to overview navigation.

_handle_quick_setup async
Python
_handle_quick_setup(interaction: Interaction) -> None

Handle quick setup actions.

on_timeout async
Python
on_timeout() -> None

Handle dashboard timeout.