Skip to content

Interactions

CAPTCHA

Try to test humans from bots.

Confirmation (InteractionResponseHelper)

Ask a user for a YES/NO/CANCEL response.

generate_response(self, type=None, ephemeral=True) inherited

Generate a response from the interaction.

Exceptions:

Type Description
RuntimeError

When cleanup or auto_respond are set to true.

generate_followup(self) inherited

Generate a followup to the interaction.

__init__(self, target, question, timeout=datetime.timedelta(seconds=900), cleanup=False, auto_respond=False) special

Ask the user to confirm, deny, or cancel.

Parameters:

Name Type Description Default
target Interaction, InteractionResponseHelper

Target of this interaction.

required
question str

Actual text of the question to prompt the user with.

required
timeout timedelta

Time before the response helper gives up.

datetime.timedelta(seconds=900)
cleanup bool

Should we delete this when an answer is received? Mutually exclusive with auto_response.

False
auto_respond bool

Should we give feedback to the user when an answer is received? Mutually exclusive with clean_up.

False

ask(self) async

Ask a question.

Returns:

Type Description
bool

Result from user. Will be None if user selected Cancel, or a timeout occurs.

Question (InteractionResponseHelper)

Ask a user a question, respond with the answer.

generate_response(self, type=None, ephemeral=True) inherited

Generate a response from the interaction.

Exceptions:

Type Description
RuntimeError

When cleanup or auto_respond are set to true.

generate_followup(self) inherited

Generate a followup to the interaction.

__init__(self, target, question, answers, timeout=datetime.timedelta(seconds=900), cleanup=False, auto_respond=False) special

Prompt user with a question to be answered by one of a list of specific answers.

Parameters:

Name Type Description Default
target Interaction|InteractionResponseHelper

Object to be responded to. Commonly an interaction, but you can chain InteractionResponseHelpers together.

required
question str

Actual text of the question to prompt the user with.

required
answers str

List of valid answers the user can give.

required
timeout timedelta

Time before the response helper gives up.

datetime.timedelta(seconds=900)
cleanup bool

Should we delete this when an answer is received? Mutually exclusive with auto_response.

False
auto_respond bool

Should we give feedback to the user when an answer is received? Mutually exclusive with clean_up.

False

ask(self) async

Ask a question.

Returns:

Type Description
bool

Result from user. Will be None if user selected Cancel, or a timeout occurs.