discord_styled.utils.options
Module with utility functions for slash commands
Options
Class, creates a slash command option options template
Options()
1
Methods
template()
Get the final template (list of options).
Please, don't run this method until you have added all your options.
template()
1
Returns
list
- List of options
add()
Adds an option to the template
add(name:str, description:str, type:Union[type, int]=3, required:bool=True, choices:list=[])
1
Parameters
- name(
str
) - Name of the option - description(
str
) - Description of the option - type(
Union[type, int]
) - Type of the option. Defaults to3
. - required(
bool
) - Whether the option is required or not. Defaults toTrue
. - choices(
list
) - List of choices. Defaults to[]
.
Returns
list
- List of options
add_from_dict()
Adds an option from a python dictionary
add_from_dict(option:dict)
1
Parameters
- options(
dict
) - Option's dictionary. The key names and value types are the same as those of the add() method
Returns
list
- List of options
add_from_dicts()
Adds options from a list of python dictionaries
add_from_dicts(options:list[dict])
1
Parameters
- options(
list[dict]
) - List of python dictionaries
Returns
list
- List of options