Buttons
ballsdex.core.utils.buttons
ConfirmChoiceView
ConfirmChoiceView(interaction: Interaction[BallsDexBot], user: User | None = None, accept_message: str = 'Confirmed', cancel_message: str = 'Cancelled')
Bases: View
An utility to prompt the user for confirmation.
Parameters:
-
interaction
(Interaction[BallsDexBot]
) –The original interaction.
-
user
(User | None
, default:None
) –The user you're interacting with. If
None
, theninteraction.user
is used. -
accept_message
(str
, default:'Confirmed'
) –The message appended to the message's content if the prompt is accepted.
-
cancel_message
(str
, default:'Cancelled'
) –The message appended to the message's content if the prompt is refused.
Attributes:
-
value
(bool | None
) –The user's choice.
None
if the interaction timed out or didn't finish. Callwait()
first.
Example
view = ConfirmChoiceView(interaction)
await interaction.response.send_message("Are you sure?", view=view)
await view.wait()
if view.value is True:
# user accepted
elif view.value is False:
# user denied
elif view.value is None:
# timed out