User Input Validators¶
This module is a compilation of user input validators.
- class Validator[source]¶
Base class for all validators.
- Parameters
message (
discord.Message
) – The message which triggered the validation.on_error (Dict) – A dictionary containing error heading and content.
dm_user (bool) – Route the message to user’s DM?
notify (bool) – Notify the user if the validation fails?
- property error_embed: Embed¶
Returns an error embed.
- Returns
An error embed.
- Return type
- property null_embed: Embed¶
Returns a null embed.
- Returns
A null embed.
- Return type
- class ChainValidator[source]¶
Chain multiple validators together.
- Parameters
validator_spec (Dict[Validator, Dict[str, Any]]) – Validator and Kwargs mapping.
- class IntegerValidator[source]¶
Validates an integer value.
- error_embed_desc = 'Please enter a valid integer.'¶
- cleaner¶
alias of
int
- class MaxValidator[source]¶
Validates a value is less than or equal to the maximum.
- Parameters
max_value (int) – The maximum value to validate against.
- Kwargs
Additional keyword arguments to pass to the superclass.
- class MinValidator[source]¶
Validates a value is greater than or equal to the minimum.
- Parameters
min_value (int) – The minimum value to validate against.
- Kwargs
Additional keyword arguments to pass to the superclass.
- class MaxLengthValidator[source]¶
Validates a string to be of a certain length.
- Parameters
max_length (int) – The maximum permissible length of the string.
- Kwargs
Additional keyword arguments to pass to the superclass.
- error_embed_desc = 'Input value has too many characters.'¶
- class MinLengthValidator[source]¶
Validates a string to be of a certain length.
- Parameters
min_length (int) – The minimum permissible length of the string.
- Kwargs
Additional keyword arguments to pass to the superclass.
- error_embed_desc = 'Input value has too few characters.'¶
- class RegexValidator[source]¶
Validates a string against a regular expression.
- Parameters
pattern (str) – The regular expression to use for validation.
- class HexValidator[source]¶
Validates if a string is a hexadecimal value.
- error_embed_title = 'Invalid Hexadecimal value'¶