forms.form
¶
Module Contents¶
Classes¶
The basic form object. |
-
class
forms.form.
Form
(ctx: commands.Context, title)¶ Bases:
object
The basic form object.
-
set_timeout
(self, timeout: int) → None¶ Sets the timeout for the form.
- Parameters
(int) (timeout) –
-
set_tries
(self, tries: int) → None¶
-
add_question
(self, question, key: str = None, qtype=None) → List[dict]¶ Adds a question to the form.
- Parameters
question (str) – The question as a string that should be added.
key (str, optional) – The prefered key to be used. If none, defaults to the to the question. By default None.
qtype (str, optional) – The input validation to be used (incomplete), by default None
- Returns
A list of all of the questions, stored as dictionaries.
- Return type
List[dict]
- Raises
InvalidFormType – Is raised when the input validation type is invalid.
-
async
validate_input
(self, qtype, answer)¶
-
edit_and_delete
(self, choice: bool = None) → bool¶ Toggles the edit and delete feature.
- Parameters
choice (bool, optional) – Whether you want the bot to edit the prompt and delete the input or not. If none, it toggles. The default for edit and delete is off. Default input is None
- Returns
The state of edit and delete (after this is completed)
- Return type
bool
-
set_retry_message
(self, message: str)¶ Sets the message to send if input validation fails.
- Parameters
message (str) – The message to be set.
-
set_incorrect_message
(self, message: str)¶ Sets the message to send if input validation fails and there are no more tries left..
- Parameters
message (str) – The message to be set.
-
async
set_color
(self, color: str) → None¶ Sets the color of the form embeds.
-
async
start
(self, channel=None) → List[dict]¶ Starts the form in the current channel.
- Parameters
channel (discord.TextChannel, optional) – The channel to open the form in. If none, it is gotten from the context object set during initialization.
- Returns
[description]
- Return type
List[dict]
-
-
exception
forms.form.
InvalidColor
¶ Bases:
Exception
Common base class for all non-exit exceptions.
-
exception
forms.form.
InvalidFormType
¶ Bases:
Exception
The exception raised when a form type is invalid.