twilight_validate::command

Function chat_input_name

Source
pub fn chat_input_name(
    value: impl AsRef<str>,
) -> Result<(), CommandValidationError>
Expand description

Validate the name of a ChatInput command.

The length of the name must be more than NAME_LENGTH_MIN and less than or equal to NAME_LENGTH_MAX. It can only contain alphanumeric characters and lowercase variants must be used where possible. Special characters - and _ are allowed.

ยงErrors

Returns an error of type NameLengthInvalid if the length is invalid.

Returns an error of type NameCharacterInvalid if the name contains a non-alphanumeric character or an uppercase character for which a lowercase variant exists.