Buttons
ballsdex.core.utils.buttons
ConfirmChoiceView
ConfirmChoiceView(ctx: Interaction[BallsDexBot] | Context[BallsDexBot], user: User | None = None, accept_message: str = 'Confirmed', cancel_message: str = 'Cancelled')
Bases: View
An utility to prompt the user for confirmation.
Parameters:
-
ctx(Interaction[BallsDexBot] | Context[BallsDexBot]) –Either a context or interaction.
-
user(User | None, default:None) –The user you're interacting with. If
None, theninteraction.useris 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.
Noneif 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