Skip to content

Commit

Permalink
Modify SelectMenuOption Emoji field to be a pointer with the `omitemp…
Browse files Browse the repository at this point in the history
…ty` json tag.
  • Loading branch information
phamill committed Jan 4, 2024
1 parent f70a015 commit 3db58a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
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

0 comments on commit 3db58a8

Please sign in to comment.