Skip to content

Commit

Permalink
fix: use choice value as string
Browse files Browse the repository at this point in the history
  • Loading branch information
themantre committed Jan 9, 2025
1 parent 03a8a20 commit d065f11
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/engine/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (ib *InputBox) UnmarshalYAML(unmarshal func(any) error) error {

type Choice struct {
Name string `yaml:"name"`
Value int `yaml:"value"`
Value string `yaml:"value"`
}

type Args struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/engine/command/crowdfund/crowdfund.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package crowdfund

import (
"context"
"fmt"

"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
Expand Down Expand Up @@ -69,7 +70,7 @@ func (c *CrowdfundCmd) GetCommand() *command.Command {
for index, pkg := range activeCampaign.Packages {
choice := command.Choice{
Name: pkg.Name,
Value: index + 1,
Value: fmt.Sprintf("%d", index+1),
}

purchaseChoices = append(purchaseChoices, choice)
Expand Down
2 changes: 1 addition & 1 deletion internal/platforms/discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ func discordOptionType(inputBox command.InputBox) discordgo.ApplicationCommandOp
case command.InputBoxToggle:
return discordgo.ApplicationCommandOptionBoolean
case command.InputBoxChoice:
return discordgo.ApplicationCommandOptionInteger
return discordgo.ApplicationCommandOptionString
default:
return discordgo.ApplicationCommandOptionString
}
Expand Down

0 comments on commit d065f11

Please sign in to comment.