mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-03-23 18:39:35 +00:00
api: Allow all types for api choices
This commit is contained in:
parent
8732dc1ff6
commit
33fbc1a1a2
|
@ -78,7 +78,7 @@ type InteractionResponseData struct {
|
|||
// Choices are the results to display on autocomplete interaction events.
|
||||
//
|
||||
// During all other events, this should not be provided.
|
||||
Choices *[]AutocompleteChoice `json:"choices"`
|
||||
Choices AutocompleteChoices `json:"choices"`
|
||||
|
||||
// CustomID used with the modal
|
||||
CustomID option.NullableString `json:"custom_id,omitempty"`
|
||||
|
@ -95,13 +95,37 @@ func (d InteractionResponseData) WriteMultipart(body *multipart.Writer) error {
|
|||
return sendpart.Write(body, d, d.Files)
|
||||
}
|
||||
|
||||
// AutocompleteChoice is the choice in ApplicationCommandAutocompleteResult in
|
||||
// the official documentation.
|
||||
type AutocompleteChoice struct {
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
// AutocompleteChoices are the choices to send back to Discord when sending a
|
||||
// ApplicationCommandAutocompleteResult interaction response.
|
||||
//
|
||||
// The following types implement this interface:
|
||||
//
|
||||
// - AutocompleteStringChoices
|
||||
// - AutocompleteIntegerChoices
|
||||
// - AutocompleteNumberChoices
|
||||
//
|
||||
type AutocompleteChoices interface {
|
||||
choices()
|
||||
}
|
||||
|
||||
// AutocompleteStringChoices are string choices to send back to Discord as
|
||||
// autocomplete results.
|
||||
type AutocompleteStringChoices []discord.StringChoice
|
||||
|
||||
func (c AutocompleteStringChoices) choices() {}
|
||||
|
||||
// AutocompleteIntegerChoices are integer choices to send back to Discord as
|
||||
// autocomplete results.
|
||||
type AutocompleteIntegerChoices []discord.IntegerChoice
|
||||
|
||||
func (c AutocompleteIntegerChoices) choices() {}
|
||||
|
||||
// AutocompleteNumberChoices are number choices to send back to Discord as
|
||||
// autocomplete results.
|
||||
type AutocompleteNumberChoices []discord.NumberChoice
|
||||
|
||||
func (c AutocompleteNumberChoices) choices() {}
|
||||
|
||||
// RespondInteraction responds to an incoming interaction. It is also known as
|
||||
// an "interaction callback".
|
||||
func (c *Client) RespondInteraction(
|
||||
|
|
Loading…
Reference in a new issue