Skip to content

confirmation

Discord Confirmation Views for Tux Bot.

This module provides confirmation dialog views for Discord interactions, allowing users to confirm or cancel potentially destructive actions. Views should ideally be sent as DMs to ensure only the requesting user can interact.

Classes:

Classes

BaseConfirmationView

Python
BaseConfirmationView(user: int)

Bases: View

Base confirmation view with confirm and cancel buttons.

Initialize the base confirmation view.

Parameters:

  • user (int) –

    The user ID that can interact with this view.

Methods:

Functions

confirm async
Python
confirm(interaction: Interaction, button: Button[View]) -> None

Handle the confirm button press.

Parameters:

  • interaction (Interaction) –

    The interaction that triggered this action.

  • button (Button[View]) –

    The button that was pressed.

cancel async
Python
cancel(interaction: Interaction, button: Button[View]) -> None

Handle the cancel button press.

Parameters:

  • interaction (Interaction) –

    The interaction that triggered this action.

  • button (Button[View]) –

    The button that was pressed.

update_button_styles
Python
update_button_styles() -> None

Update button styles for the confirmation view.

ConfirmationDanger

Python
ConfirmationDanger(user: int)

Bases: BaseConfirmationView

Confirmation view with a danger button.

Initialize the danger confirmation view.

Parameters:

  • user (int) –

    The user ID that can interact with this view.

Methods:

Functions

confirm async
Python
confirm(interaction: Interaction, button: Button[View]) -> None

Handle the confirm button press.

Parameters:

  • interaction (Interaction) –

    The interaction that triggered this action.

  • button (Button[View]) –

    The button that was pressed.

cancel async
Python
cancel(interaction: Interaction, button: Button[View]) -> None

Handle the cancel button press.

Parameters:

  • interaction (Interaction) –

    The interaction that triggered this action.

  • button (Button[View]) –

    The button that was pressed.

update_button_styles
Python
update_button_styles() -> None

Update button styles for the confirmation view.

ConfirmationNormal

Python
ConfirmationNormal(user: int)

Bases: BaseConfirmationView

Confirmation view with a normal button.

Initialize the normal confirmation view.

Parameters:

  • user (int) –

    The user ID that can interact with this view.

Methods:

Functions

confirm async
Python
confirm(interaction: Interaction, button: Button[View]) -> None

Handle the confirm button press.

Parameters:

  • interaction (Interaction) –

    The interaction that triggered this action.

  • button (Button[View]) –

    The button that was pressed.

cancel async
Python
cancel(interaction: Interaction, button: Button[View]) -> None

Handle the cancel button press.

Parameters:

  • interaction (Interaction) –

    The interaction that triggered this action.

  • button (Button[View]) –

    The button that was pressed.

update_button_styles
Python
update_button_styles() -> None

Update button styles for the confirmation view.