fix(util/utils): fix logic error in validateSlashOptions() (#699)

This commit is contained in:
ITOH
2021-03-28 18:22:42 +02:00
committed by GitHub
parent 4eb59f8511
commit 89e4b1eacd

View File

@@ -140,9 +140,10 @@ function validateSlashOptionChoices(
function validateSlashOptions(options: SlashCommandOption[]) {
for (const option of options) {
if (
(option.choices?.length && option.choices.length > 25) ||
option.type !== SlashCommandOptionType.STRING &&
option.type !== SlashCommandOptionType.INTEGER
option.choices?.length &&
(option.choices.length > 25 ||
(option.type !== SlashCommandOptionType.STRING &&
option.type !== SlashCommandOptionType.INTEGER))
) {
throw new Error(Errors.INVALID_SLASH_OPTIONS_CHOICES);
}