diff options
| -rw-r--r-- | commands/config.go | 6 | ||||
| -rw-r--r-- | config/xp_role.go | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/commands/config.go b/commands/config.go index 5a2f763..fc15a5c 100644 --- a/commands/config.go +++ b/commands/config.go @@ -2,7 +2,7 @@ package commands import ( "fmt" - "sort" + "slices" "strings" "git.anhgelus.world/anhgelus/les-copaings-bot/config" @@ -24,8 +24,8 @@ func ConfigResponse(i *discordgo.InteractionCreate) *interaction.Response { cfg := config.GetGuildConfig(i.GuildID) roles := "" l := len(cfg.XpRoles) - 1 - sort.Slice(cfg.XpRoles, func(i, j int) bool { - return cfg.XpRoles[i].XP > cfg.XpRoles[j].XP + slices.SortFunc(cfg.XpRoles, func(xp1, xp2 config.XpRole) int { + return int(xp2.XP) - int(xp1.XP) }) for i, r := range cfg.XpRoles { if i == l { diff --git a/config/xp_role.go b/config/xp_role.go index 8939dd6..d55e6d3 100644 --- a/config/xp_role.go +++ b/config/xp_role.go @@ -2,7 +2,7 @@ package config import ( "fmt" - "sort" + "slices" "strconv" "git.anhgelus.world/anhgelus/les-copaings-bot/exp" @@ -47,8 +47,8 @@ func HandleXpRole( &component.Separator{}, }, } - sort.Slice(cfg.XpRoles, func(i, j int) bool { - return cfg.XpRoles[i].XP > cfg.XpRoles[j].XP + slices.SortFunc(cfg.XpRoles, func(xp1, xp2 XpRole) int { + return int(xp2.XP) - int(xp1.XP) }) for _, r := range cfg.XpRoles { container.Components = append(container.Components, &component.Section{ |
