From 70a7a3e44f2cfb86d8728058a55559f62e23b9f0 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Thu, 13 Oct 2022 22:29:17 -0700 Subject: [PATCH] discord: Add some omitempty for interaction.go --- discord/interaction.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/discord/interaction.go b/discord/interaction.go index 99f97d5..44ee03f 100644 --- a/discord/interaction.go +++ b/discord/interaction.go @@ -206,9 +206,9 @@ func (o AutocompleteOptions) Find(name string) AutocompleteOption { type AutocompleteOption struct { Type CommandOptionType `json:"type"` Name string `json:"name"` - Value json.Raw `json:"value"` - Focused bool `json:"focused"` - Options []AutocompleteOption `json:"options"` + Value json.Raw `json:"value,omitempty"` + Focused bool `json:"focused,omitempty"` + Options []AutocompleteOption `json:"options,omitempty"` } // String will return the value if the option's value is a valid string. @@ -350,7 +350,7 @@ type CommandInteractionOptions []CommandInteractionOption type CommandInteraction struct { ID CommandID `json:"id"` 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 GuildID `json:"guild_id,omitempty"` // 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 CommandOptionType `json:"type"` Name string `json:"name"` - Value json.Raw `json:"value"` - Options CommandInteractionOptions `json:"options"` + Value json.Raw `json:"value,omitempty"` + Options CommandInteractionOptions `json:"options,omitempty"` } var optionSupportedSnowflakeTypes = map[reflect.Type]CommandOptionType{