Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omit empty SelectMenuOption.Emoji field #1476

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions components.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ func (Button) Type() ComponentType {

// SelectMenuOption represents an option for a select menu.
type SelectMenuOption struct {
Label string `json:"label,omitempty"`
Value string `json:"value"`
Description string `json:"description"`
Emoji ComponentEmoji `json:"emoji"`
Label string `json:"label,omitempty"`
Value string `json:"value"`
Description string `json:"description"`
Emoji *ComponentEmoji `json:"emoji,omitempty"`
// Determines whenever option is selected by default or not.
Default bool `json:"default"`
}
Expand Down
16 changes: 8 additions & 8 deletions examples/components/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ var (
// As with components, this things must have their own unique "id" to identify which is which.
// In this case such id is Value field.
Value: "go",
Emoji: discordgo.ComponentEmoji{
Emoji: &discordgo.ComponentEmoji{
Name: "🦦",
},
// You can also make it a default option, but in this case we won't.
Expand All @@ -307,15 +307,15 @@ var (
{
Label: "JS",
Value: "js",
Emoji: discordgo.ComponentEmoji{
Emoji: &discordgo.ComponentEmoji{
Name: "🟨",
},
Description: "JavaScript programming language",
},
{
Label: "Python",
Value: "py",
Emoji: discordgo.ComponentEmoji{
Emoji: &discordgo.ComponentEmoji{
Name: "🐍",
},
Description: "Python programming language",
Expand Down Expand Up @@ -352,39 +352,39 @@ var (
Value: "go",
// Default works the same for multi-select menus.
Default: false,
Emoji: discordgo.ComponentEmoji{
Emoji: &discordgo.ComponentEmoji{
Name: "🦦",
},
},
{
Label: "JS",
Description: "Multiparadigm OOP language",
Value: "javascript",
Emoji: discordgo.ComponentEmoji{
Emoji: &discordgo.ComponentEmoji{
Name: "🟨",
},
},
{
Label: "Python",
Description: "OOP prototyping programming language",
Value: "python",
Emoji: discordgo.ComponentEmoji{
Emoji: &discordgo.ComponentEmoji{
Name: "🐍",
},
},
{
Label: "Web",
Description: "Web related technologies",
Value: "web",
Emoji: discordgo.ComponentEmoji{
Emoji: &discordgo.ComponentEmoji{
Name: "🌐",
},
},
{
Label: "Desktop",
Description: "Desktop applications",
Value: "desktop",
Emoji: discordgo.ComponentEmoji{
Emoji: &discordgo.ComponentEmoji{
Name: "💻",
},
},
Expand Down