Skip to content

Commit

Permalink
fix select menu option emojis being required
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinfuchs committed Feb 21, 2024
1 parent e13461a commit b56e289
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
16 changes: 3 additions & 13 deletions embedg-server/actions/parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,43 +38,33 @@ func (m *ActionParser) ParseMessageComponents(data []actions.ActionRowWithAction
}

for y, component := range row.Components {
var emoji *discordgo.ComponentEmoji
if component.Emoji != nil {
emoji = component.Emoji
}

if component.Type == discordgo.ButtonComponent {
if component.Style == discordgo.LinkButton {
ar.Components[y] = discordgo.Button{
Label: component.Label,
Style: component.Style,
Disabled: component.Disabled,
URL: component.URL,
Emoji: emoji,
Emoji: component.Emoji,
}
} else {
ar.Components[y] = discordgo.Button{
CustomID: "action:" + component.ActionSetID,
Label: component.Label,
Style: component.Style,
Disabled: component.Disabled,
Emoji: emoji,
Emoji: component.Emoji,
}
}
} else if component.Type == discordgo.SelectMenuComponent {
options := make([]discordgo.SelectMenuOption, len(component.Options))
for x, option := range component.Options {
var emoji discordgo.ComponentEmoji
if option.Emoji != nil {
emoji = *option.Emoji
}

options[x] = discordgo.SelectMenuOption{
Label: option.Label,
Value: "action:" + option.ActionSetID,
Description: option.Description,
Default: option.Default,
Emoji: emoji,
Emoji: option.Emoji,
}
}

Expand Down
2 changes: 1 addition & 1 deletion embedg-server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.7
github.com/matoous/go-nanoid v1.5.0
github.com/merlinfuchs/discordgo v0.0.0-20240104092729-b8cc2e0c165b
github.com/merlinfuchs/discordgo v0.0.0-20240221125351-790f911def01
github.com/merlinfuchs/embed-generator/embedg-app v0.0.0
github.com/merlinfuchs/embed-generator/embedg-site v0.0.0-20231008112155-6159480ecdbf
github.com/minio/minio-go/v7 v7.0.63
Expand Down
2 changes: 2 additions & 0 deletions embedg-server/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,8 @@ github.com/merlinfuchs/discordgo v0.0.0-20240104092355-59e25c210200 h1:85KegQyhC
github.com/merlinfuchs/discordgo v0.0.0-20240104092355-59e25c210200/go.mod h1:xAeB1tSUX3ilHSX7DKudmCAuIj5z/UZJDCbr8QKpMzI=
github.com/merlinfuchs/discordgo v0.0.0-20240104092729-b8cc2e0c165b h1:kDFUnynkS2q4ydT1BbUG1/jR0UQk92tnRLHhmFWJ9ac=
github.com/merlinfuchs/discordgo v0.0.0-20240104092729-b8cc2e0c165b/go.mod h1:xAeB1tSUX3ilHSX7DKudmCAuIj5z/UZJDCbr8QKpMzI=
github.com/merlinfuchs/discordgo v0.0.0-20240221125351-790f911def01 h1:EN+AN5hZY7kQoFT5DYemGyzAqf+EOq36DQKGq1nnZ+k=
github.com/merlinfuchs/discordgo v0.0.0-20240221125351-790f911def01/go.mod h1:xAeB1tSUX3ilHSX7DKudmCAuIj5z/UZJDCbr8QKpMzI=
github.com/merlinfuchs/embed-generator/embedg-site v0.0.0-20231008112155-6159480ecdbf h1:2gfrkGaSc94oc2XhTvXHzs43h3KozEKt/xqgShill5M=
github.com/merlinfuchs/embed-generator/embedg-site v0.0.0-20231008112155-6159480ecdbf/go.mod h1:JcvikErltUsWRvLr2KcxeoKfwOSNkgxIaYk0oBBFVRQ=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
Expand Down

0 comments on commit b56e289

Please sign in to comment.