1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-10-31 20:14:21 +00:00

discord: Add some omitempty for interaction.go

This commit is contained in:
diamondburned 2022-10-13 22:29:17 -07:00
parent e058e7c7b7
commit 70a7a3e44f
No known key found for this signature in database
GPG key ID: D78C4471CE776659

View file

@ -206,9 +206,9 @@ func (o AutocompleteOptions) Find(name string) AutocompleteOption {
type AutocompleteOption struct { type AutocompleteOption struct {
Type CommandOptionType `json:"type"` Type CommandOptionType `json:"type"`
Name string `json:"name"` Name string `json:"name"`
Value json.Raw `json:"value"` Value json.Raw `json:"value,omitempty"`
Focused bool `json:"focused"` Focused bool `json:"focused,omitempty"`
Options []AutocompleteOption `json:"options"` Options []AutocompleteOption `json:"options,omitempty"`
} }
// String will return the value if the option's value is a valid string. // String will return the value if the option's value is a valid string.
@ -350,7 +350,7 @@ type CommandInteractionOptions []CommandInteractionOption
type CommandInteraction struct { type CommandInteraction struct {
ID CommandID `json:"id"` ID CommandID `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Options CommandInteractionOptions `json:"options"` Options CommandInteractionOptions `json:"options,omitempty"`
// GuildID is the id of the guild the command is registered to // GuildID is the id of the guild the command is registered to
GuildID GuildID `json:"guild_id,omitempty"` GuildID GuildID `json:"guild_id,omitempty"`
// TargetID is the id of the user or message targeted by a user or message command. // TargetID is the id of the user or message targeted by a user or message command.
@ -398,8 +398,8 @@ func (*CommandInteraction) data() {}
type CommandInteractionOption struct { type CommandInteractionOption struct {
Type CommandOptionType `json:"type"` Type CommandOptionType `json:"type"`
Name string `json:"name"` Name string `json:"name"`
Value json.Raw `json:"value"` Value json.Raw `json:"value,omitempty"`
Options CommandInteractionOptions `json:"options"` Options CommandInteractionOptions `json:"options,omitempty"`
} }
var optionSupportedSnowflakeTypes = map[reflect.Type]CommandOptionType{ var optionSupportedSnowflakeTypes = map[reflect.Type]CommandOptionType{