Skip to content

Commit

Permalink
Fix die size options order (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiJeTi authored Jun 18, 2024
1 parent 30c03ff commit 8a96c4c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/commands/roll.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package commands

import (
"sort"

"github.com/bwmarrin/discordgo"

"github.com/nijeti/cinema-keeper/internal/pkg/die"
Expand Down Expand Up @@ -37,6 +39,11 @@ func buildRoll() *discordgo.ApplicationCommand {
choices = append(choices, c)
}

sort.Slice(
choices, func(i, j int) bool {
return choices[i].Value.(die.Size) < choices[j].Value.(die.Size)
})

return &discordgo.ApplicationCommand{
Name: RollName,
Description: "Roll a die",
Expand Down

0 comments on commit 8a96c4c

Please sign in to comment.