From c5f8fff98fb3a712995f914c0ffb1dec170b6179 Mon Sep 17 00:00:00 2001 From: Tyler Stuyfzand Date: Mon, 14 Feb 2022 01:39:32 -0500 Subject: [PATCH] discord: Add Autocomplete flag to some options (#311) * Add Autocomplete flags to Number and Integer options * Add autocomplete warning for choices --- discord/command.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/discord/command.go b/discord/command.go index c2de315..388efb4 100644 --- a/discord/command.go +++ b/discord/command.go @@ -363,11 +363,12 @@ type CommandOptionValue interface { // StringOption is a subcommand option that fits into a CommandOptionValue. type StringOption struct { - OptionName string `json:"name"` - Description string `json:"description"` - Required bool `json:"required"` - Choices []StringChoice `json:"choices,omitempty"` - Autocomplete bool `json:"autocomplete"` + OptionName string `json:"name"` + Description string `json:"description"` + Required bool `json:"required"` + Choices []StringChoice `json:"choices,omitempty"` + // Autocomplete must not be true if Choices are present. + Autocomplete bool `json:"autocomplete"` } // Name implements CommandOption. @@ -391,6 +392,8 @@ type IntegerOption struct { Min option.Int `json:"min_value,omitempty"` Max option.Int `json:"max_value,omitempty"` Choices []IntegerChoice `json:"choices,omitempty"` + // Autocomplete must not be true if Choices are present. + Autocomplete bool `json:"autocomplete"` } // Name implements CommandOption. @@ -485,6 +488,8 @@ type NumberOption struct { Min option.Float `json:"min_value,omitempty"` Max option.Float `json:"max_value,omitempty"` Choices []NumberChoice `json:"choices,omitempty"` + // Autocomplete must not be true if Choices are present. + Autocomplete bool `json:"autocomplete"` } // Name implements CommandOption.