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 ¶
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:
-
invalidate_cache–Invalidate cached components for performance optimization.
-
get_cached_mode–Get cached container for a mode if available.
-
cache_mode–Cache a built container for a mode.
-
build_layout–Build the dashboard layout based on current mode.
-
build_ranks_mode–Build the ranks management mode (create, delete, view ranks).
-
build_roles_mode–Build the role-to-rank assignment mode.
-
update_role_selection_ui–Update the role assignment UI with selected roles.
-
build_commands_mode–Build the command permissions configuration mode.
-
build_logs_mode–Build logs configuration mode with improved organization.
-
find_channel_select_component–Find a ChannelSelect component by custom_id.
-
resolve_channel_from_interaction–Resolve selected channel from component or interaction data.
-
update_channel_and_rebuild–Update channel config and rebuild logs mode.
-
handle_back_to_overview–Handle back to overview navigation.
-
on_timeout–Handle dashboard timeout.
Classes¶
RanksButton ¶
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 ¶callback(interaction: Interaction) -> None
Handle button click to switch to ranks mode.
RolesButton ¶
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 ¶callback(interaction: Interaction) -> None
Handle button click to switch to roles mode.
CommandsButton ¶
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 ¶callback(interaction: Interaction) -> None
Handle button click to switch to commands mode.
LogsButton ¶
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 ¶callback(interaction: Interaction) -> None
Handle button click to switch to logs mode.
ResetButton ¶
ResetButton()
Bases: Button[LayoutView]
Button to reset all configuration to defaults.
Methods:
-
callback–Handle button click to reset configuration.
Functions¶
callback async ¶callback(interaction: Interaction) -> None
Handle button click to reset configuration.
Functions¶
_get_cache_key ¶
Generate cache key for a mode based on current pagination state.
_build_pagination_footer ¶
_build_pagination_footer(mode: str) -> TextDisplay[LayoutView]
Build pagination footer showing current page info.
_build_pagination_info_footer ¶
_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 ¶
_build_pagination_navigation(
mode: str, rebuild_method: Callable[[], Awaitable[None]]
) -> ActionRow[LayoutView]
Build navigation buttons for pagination (generic helper).
_handle_page_change async ¶
_handle_page_change(
interaction: Interaction, mode: str, rebuild_method: Callable[[], Awaitable[None]]
) -> None
Handle pagination button clicks (generic helper).
invalidate_cache ¶
invalidate_cache(mode: str | None = None) -> None
Invalidate cached components for performance optimization.
get_cached_mode ¶
get_cached_mode(mode: str) -> Container[LayoutView] | None
Get cached container for a mode if available.
cache_mode ¶
cache_mode(mode: str, container: Container[LayoutView]) -> None
Cache a built container for a mode.
_build_overview_mode ¶
_build_overview_mode() -> None
Build the overview/dashboard mode with a creative card-based layout.
build_ranks_mode async ¶
build_ranks_mode() -> None
Build the ranks management mode (create, delete, view ranks).
_group_assignments_by_rank ¶
_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 ¶
_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 ¶
_build_rank_status_display(
rank_assignments: list[dict[str, Any]],
) -> TextDisplay[LayoutView]
Build the status display for a rank.
_build_role_selector ¶
_build_role_selector(
rank: Any, rank_assignments: list[dict[str, Any]]
) -> RoleSelect[LayoutView] | None
Build a role selector for a rank.
_validate_rank_for_assignment async ¶
Validate rank exists and return its database ID.
_build_role_assignment_view ¶
_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 ¶
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 ¶
_handle_assign_role(interaction: Interaction) -> None
Handle assigning a role to a rank using a modal.
_handle_confirm_assign_role async ¶
_handle_confirm_assign_role(interaction: Interaction) -> None
Handle confirming role assignment.
_handle_remove_role async ¶
_handle_remove_role(interaction: Interaction) -> None
Handle removing roles from a rank.
_find_role_select_from_message ¶
Find a RoleSelect component from a message and return its selected values.
_handle_confirm_remove_role async ¶
_handle_confirm_remove_role(interaction: Interaction) -> None
Handle confirming role removal.
_handle_cancel_assign async ¶
_handle_cancel_assign(interaction: Interaction) -> None
Handle canceling role assignment/removal.
_build_command_display ¶
_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 ¶
_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 ¶
_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 ¶
build_commands_mode() -> None
Build the command permissions configuration mode.
_build_log_option_display ¶
_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 ¶
_build_log_status_display(
current_channel: TextChannel | None,
) -> TextDisplay[LayoutView]
Build the status display for a log option.
_build_log_channel_selector ¶
_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 ¶
build_logs_mode() -> None
Build logs configuration mode with improved organization.
find_channel_select_component ¶
find_channel_select_component(custom_id: str) -> ChannelSelect[LayoutView] | None
Find a ChannelSelect component by custom_id.
resolve_channel_from_interaction ¶
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 ¶
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 ¶
Save channel configuration to database.
_build_error_mode ¶
_build_error_mode(error_message: str) -> None
Build an error display mode.
_handle_mode_change async ¶
_handle_mode_change(interaction: Interaction) -> None
Handle mode changes from overview buttons.
_handle_create_rank async ¶
_handle_create_rank(interaction: Interaction) -> None
Handle create rank button click - opens modal.
_handle_init_default_ranks async ¶
_handle_init_default_ranks(interaction: Interaction) -> None
Handle init default ranks button click - creates default ranks 0-7.
handle_back_to_overview async ¶
handle_back_to_overview(interaction: Interaction) -> None
Handle back to overview navigation.
_handle_quick_setup async ¶
_handle_quick_setup(interaction: Interaction) -> None
Handle quick setup actions.