Skip to content

components

UI components for the help command system.

This module contains all the UI components used by the help command, including: - Base views and components - Select menus for categories, commands, and subcommands - Navigation buttons - Pagination components

Classes:

  • HelpCommandProtocol

    Protocol defining methods a help command must implement.

  • BaseHelpView

    Base view for all help command navigation.

  • BaseSelectMenu

    Base class for help selection menus.

  • BaseButton

    Base class for help navigation buttons.

  • CategorySelectMenu

    Select menu for choosing a command category.

  • CommandSelectMenu

    Select menu for choosing a command within a category.

  • SubcommandSelectMenu

    Select menu for choosing a subcommand within a command group.

  • BackButton

    Button for navigating back to the previous page.

  • CloseButton

    Button for closing the help menu.

  • PaginationButton

    Base class for pagination buttons.

  • NextButton

    Button for navigating to the next page of subcommands.

  • PrevButton

    Button for navigating to the previous page of subcommands.

  • HelpView

    Main view for the help command with standard navigation.

  • DirectHelpView

    View for paginated direct help commands with previous/next buttons.

Classes

HelpCommandProtocol

Bases: Protocol

Protocol defining methods a help command must implement.

Methods:

Attributes:

Attributes

context property
Python
context: Context[Any]

Get the Discord context for this help command.

Functions

on_category_select async
Python
on_category_select(interaction: Interaction, category: str) -> None

Handle category selection from dropdown menu.

on_command_select async
Python
on_command_select(interaction: Interaction, command_name: str) -> None

Handle command selection from dropdown menu.

on_subcommand_select async
Python
on_subcommand_select(interaction: Interaction, subcommand_name: str) -> None

Handle subcommand selection from dropdown menu.

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

Handle back navigation button press.

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

Handle next page navigation button press.

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

Handle previous page navigation button press.

BaseHelpView

Python
BaseHelpView(help_command: HelpCommandProtocol, timeout: int = 180)

Bases: View

Base view for all help command navigation.

Initialize the base help view.

Parameters:

  • help_command (HelpCommandProtocol) –

    The help command instance this view belongs to.

  • timeout (int, default: 180 ) –

    View timeout in seconds (default 180).

Methods:

Functions

interaction_check async
Python
interaction_check(interaction: Interaction) -> bool

Ensure only the invoker can interact with this view.

Returns:

  • bool

    True if the interaction user is the author, False otherwise.

BaseSelectMenu

Python
BaseSelectMenu(
    help_command: HelpCommandProtocol, options: list[SelectOption], placeholder: str
)

Bases: Select[BaseHelpView]

Base class for help selection menus.

Initialize the base select menu.

Parameters:

  • help_command (HelpCommandProtocol) –

    The help command instance this menu belongs to.

  • options (list[SelectOption]) –

    List of options for the select menu.

  • placeholder (str) –

    Placeholder text for the select menu.

Methods:

  • handle_select

    Handle a selection from this menu.

  • callback

    Handle the callback when an option is selected.

Functions

handle_select abstractmethod async
Python
handle_select(interaction: Interaction, selected_value: str) -> None

Handle a selection from this menu.

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

Handle the callback when an option is selected.

BaseButton

Python
BaseButton(
    help_command: HelpCommandProtocol,
    style: ButtonStyle,
    label: str,
    emoji: str,
    custom_id: str,
    disabled: bool = False,
)

Bases: Button[BaseHelpView]

Base class for help navigation buttons.

Initialize the base button.

Parameters:

  • help_command (HelpCommandProtocol) –

    The help command instance this button belongs to.

  • style (ButtonStyle) –

    The button style (primary, secondary, success, danger, link).

  • label (str) –

    The button label text.

  • emoji (str) –

    The button emoji.

  • custom_id (str) –

    Unique identifier for the button.

  • disabled (bool, default: False ) –

    Whether the button is disabled (default False).

Methods:

  • handle_click

    Handle a click on this button.

  • callback

    Handle the callback when the button is clicked.

Functions

handle_click abstractmethod async
Python
handle_click(interaction: Interaction) -> None

Handle a click on this button.

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

Handle the callback when the button is clicked.

CategorySelectMenu

Python
CategorySelectMenu(
    help_command: HelpCommandProtocol, options: list[SelectOption], placeholder: str
)

Bases: BaseSelectMenu

Select menu for choosing a command category.

Initialize the base select menu.

Parameters:

  • help_command (HelpCommandProtocol) –

    The help command instance this menu belongs to.

  • options (list[SelectOption]) –

    List of options for the select menu.

  • placeholder (str) –

    Placeholder text for the select menu.

Methods:

  • callback

    Handle the callback when an option is selected.

  • handle_select

    Handle when a category is selected.

Functions

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

Handle the callback when an option is selected.

handle_select async
Python
handle_select(interaction: Interaction, selected_value: str) -> None

Handle when a category is selected.

CommandSelectMenu

Python
CommandSelectMenu(
    help_command: HelpCommandProtocol, options: list[SelectOption], placeholder: str
)

Bases: BaseSelectMenu

Select menu for choosing a command within a category.

Initialize the base select menu.

Parameters:

  • help_command (HelpCommandProtocol) –

    The help command instance this menu belongs to.

  • options (list[SelectOption]) –

    List of options for the select menu.

  • placeholder (str) –

    Placeholder text for the select menu.

Methods:

  • callback

    Handle the callback when an option is selected.

  • handle_select

    Handle when a command is selected.

Functions

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

Handle the callback when an option is selected.

handle_select async
Python
handle_select(interaction: Interaction, selected_value: str) -> None

Handle when a command is selected.

SubcommandSelectMenu

Python
SubcommandSelectMenu(
    help_command: HelpCommandProtocol, options: list[SelectOption], placeholder: str
)

Bases: BaseSelectMenu

Select menu for choosing a subcommand within a command group.

Initialize the base select menu.

Parameters:

  • help_command (HelpCommandProtocol) –

    The help command instance this menu belongs to.

  • options (list[SelectOption]) –

    List of options for the select menu.

  • placeholder (str) –

    Placeholder text for the select menu.

Methods:

  • callback

    Handle the callback when an option is selected.

  • handle_select

    Handle when a subcommand is selected.

Functions

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

Handle the callback when an option is selected.

handle_select async
Python
handle_select(interaction: Interaction, selected_value: str) -> None

Handle when a subcommand is selected.

BackButton

Python
BackButton(help_command: HelpCommandProtocol)

Bases: BaseButton

Button for navigating back to the previous page.

Initialize the back navigation button.

Parameters:

Methods:

  • callback

    Handle the callback when the button is clicked.

  • handle_click

    Handle when the back button is clicked.

Functions

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

Handle the callback when the button is clicked.

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

Handle when the back button is clicked.

CloseButton

Python
CloseButton()

Bases: Button[BaseHelpView]

Button for closing the help menu.

Initialize the close button for dismissing the help menu.

Methods:

  • callback

    Handle when the close button is clicked.

Functions

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

Handle when the close button is clicked.

PaginationButton

Python
PaginationButton(
    help_command: HelpCommandProtocol,
    label: str,
    emoji: str,
    custom_id: str,
    is_next: bool,
)

Bases: BaseButton

Base class for pagination buttons.

Initialize the pagination button.

Parameters:

  • help_command (HelpCommandProtocol) –

    The help command instance this button belongs to.

  • label (str) –

    The button label text.

  • emoji (str) –

    The button emoji.

  • custom_id (str) –

    Unique identifier for the button.

  • is_next (bool) –

    Whether this is a "next" button (True) or "previous" button (False).

Methods:

  • handle_click

    Handle a click on this button.

  • callback

    Handle the callback when the button is clicked.

Functions

handle_click abstractmethod async
Python
handle_click(interaction: Interaction) -> None

Handle a click on this button.

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

Handle the callback when the button is clicked.

NextButton

Python
NextButton(help_command: HelpCommandProtocol)

Bases: PaginationButton

Button for navigating to the next page of subcommands.

Initialize the next page navigation button.

Parameters:

Methods:

  • callback

    Handle the callback when the button is clicked.

  • handle_click

    Handle when the next button is clicked.

Functions

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

Handle the callback when the button is clicked.

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

Handle when the next button is clicked.

PrevButton

Python
PrevButton(help_command: HelpCommandProtocol)

Bases: PaginationButton

Button for navigating to the previous page of subcommands.

Initialize the previous page navigation button.

Parameters:

Methods:

  • callback

    Handle the callback when the button is clicked.

  • handle_click

    Handle when the previous button is clicked.

Functions

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

Handle the callback when the button is clicked.

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

Handle when the previous button is clicked.

HelpView

Python
HelpView(help_command: HelpCommandProtocol, timeout: int = 180)

Bases: BaseHelpView

Main view for the help command with standard navigation.

Initialize the base help view.

Parameters:

  • help_command (HelpCommandProtocol) –

    The help command instance this view belongs to.

  • timeout (int, default: 180 ) –

    View timeout in seconds (default 180).

Methods:

Functions

interaction_check async
Python
interaction_check(interaction: Interaction) -> bool

Ensure only the invoker can interact with this view.

Returns:

  • bool

    True if the interaction user is the author, False otherwise.

DirectHelpView

Python
DirectHelpView(
    help_command: HelpCommandProtocol,
    group: Group[Any, Any, Any],
    pages: list[list[Command[Any, Any, Any]]],
)

Bases: BaseHelpView

View for paginated direct help commands with previous/next buttons.

Initialize the direct help view with pagination.

Parameters:

Methods:

Functions

interaction_check async
Python
interaction_check(interaction: Interaction) -> bool

Ensure only the invoker can interact with this view.

Returns:

  • bool

    True if the interaction user is the author, False otherwise.

get_embed async
Python
get_embed() -> Embed

Get the embed for the current page.

Returns:

  • Embed

    The embed for the current subcommand page.

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

Handle previous page button press.

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

Handle next page button press.

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

Handle close button press.