Skip to content

Commit dd8719c

Browse files
committed
Fixed error if choices is not passed to create_option
1 parent 69f125d commit dd8719c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

discord_slash/utils/manage_commands.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,14 @@ def create_option(name: str,
166166
option_type = SlashCommandOptionType.from_type(original_type)
167167
if option_type is None:
168168
raise IncorrectType(f"The type {original_type} is not recognized as a type that Discord accepts for slash commands.")
169+
choices = choices or []
169170
choices = [choice if isinstance(choice, dict) else {"name": choice, "value": choice} for choice in choices]
170171
return {
171172
"name": name,
172173
"description": description,
173174
"type": option_type,
174175
"required": required,
175-
"choices": choices or []
176+
"choices": choices
176177
}
177178

178179

0 commit comments

Comments
 (0)