fix(SelectMenuOption)!: omit empty emoji field (#1476)

This commit is contained in:
Paul Hamill 2024-01-04 11:11:17 -08:00 committed by GitHub
parent f70a01544f
commit afc57886f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View file

@ -166,10 +166,10 @@ func (Button) Type() ComponentType {
// SelectMenuOption represents an option for a select menu. // SelectMenuOption represents an option for a select menu.
type SelectMenuOption struct { type SelectMenuOption struct {
Label string `json:"label,omitempty"` Label string `json:"label,omitempty"`
Value string `json:"value"` Value string `json:"value"`
Description string `json:"description"` Description string `json:"description"`
Emoji ComponentEmoji `json:"emoji"` Emoji *ComponentEmoji `json:"emoji,omitempty"`
// Determines whenever option is selected by default or not. // Determines whenever option is selected by default or not.
Default bool `json:"default"` Default bool `json:"default"`
} }

View file

@ -297,7 +297,7 @@ var (
// As with components, this things must have their own unique "id" to identify which is which. // As with components, this things must have their own unique "id" to identify which is which.
// In this case such id is Value field. // In this case such id is Value field.
Value: "go", Value: "go",
Emoji: discordgo.ComponentEmoji{ Emoji: &discordgo.ComponentEmoji{
Name: "🦦", Name: "🦦",
}, },
// You can also make it a default option, but in this case we won't. // You can also make it a default option, but in this case we won't.
@ -307,7 +307,7 @@ var (
{ {
Label: "JS", Label: "JS",
Value: "js", Value: "js",
Emoji: discordgo.ComponentEmoji{ Emoji: &discordgo.ComponentEmoji{
Name: "🟨", Name: "🟨",
}, },
Description: "JavaScript programming language", Description: "JavaScript programming language",
@ -315,7 +315,7 @@ var (
{ {
Label: "Python", Label: "Python",
Value: "py", Value: "py",
Emoji: discordgo.ComponentEmoji{ Emoji: &discordgo.ComponentEmoji{
Name: "🐍", Name: "🐍",
}, },
Description: "Python programming language", Description: "Python programming language",
@ -352,7 +352,7 @@ var (
Value: "go", Value: "go",
// Default works the same for multi-select menus. // Default works the same for multi-select menus.
Default: false, Default: false,
Emoji: discordgo.ComponentEmoji{ Emoji: &discordgo.ComponentEmoji{
Name: "🦦", Name: "🦦",
}, },
}, },
@ -360,7 +360,7 @@ var (
Label: "JS", Label: "JS",
Description: "Multiparadigm OOP language", Description: "Multiparadigm OOP language",
Value: "javascript", Value: "javascript",
Emoji: discordgo.ComponentEmoji{ Emoji: &discordgo.ComponentEmoji{
Name: "🟨", Name: "🟨",
}, },
}, },
@ -368,7 +368,7 @@ var (
Label: "Python", Label: "Python",
Description: "OOP prototyping programming language", Description: "OOP prototyping programming language",
Value: "python", Value: "python",
Emoji: discordgo.ComponentEmoji{ Emoji: &discordgo.ComponentEmoji{
Name: "🐍", Name: "🐍",
}, },
}, },
@ -376,7 +376,7 @@ var (
Label: "Web", Label: "Web",
Description: "Web related technologies", Description: "Web related technologies",
Value: "web", Value: "web",
Emoji: discordgo.ComponentEmoji{ Emoji: &discordgo.ComponentEmoji{
Name: "🌐", Name: "🌐",
}, },
}, },
@ -384,7 +384,7 @@ var (
Label: "Desktop", Label: "Desktop",
Description: "Desktop applications", Description: "Desktop applications",
Value: "desktop", Value: "desktop",
Emoji: discordgo.ComponentEmoji{ Emoji: &discordgo.ComponentEmoji{
Name: "💻", Name: "💻",
}, },
}, },