aboutsummaryrefslogtreecommitdiff
path: root/commands/top.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/top.go')
-rw-r--r--commands/top.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/commands/top.go b/commands/top.go
index db44dbd..d816c55 100644
--- a/commands/top.go
+++ b/commands/top.go
@@ -3,6 +3,7 @@ package commands
import (
"context"
"fmt"
+ "strings"
"sync"
"git.anhgelus.world/anhgelus/les-copaings-bot/config"
@@ -26,7 +27,7 @@ func Top(ctx context.Context, dg bot.Session, i *interaction.ApplicationCommand)
}
}
- cfg := config.GetGuildConfig(ctx, i.GuildID)
+ cfg := config.GetGuild(ctx, i.GuildID)
if cfg.DaysXPRemains > 30 {
wg.Go(func() {
fn(fmt.Sprintf("Top %d jours", cfg.DaysXPRemains), 10, -1, 0)
@@ -57,12 +58,13 @@ func Top(ctx context.Context, dg bot.Session, i *interaction.ApplicationCommand)
}
func genTopsMessage(tops []user.CopaingCached) string {
- msg := ""
+ var sb strings.Builder
for i, c := range tops {
- msg += fmt.Sprintf("%d. **<@%d>** - niveau %d", i+1, c.ID, exp.Level(c.XP))
+ ft := fmt.Sprintf("%d. **<@%d>** - niveau %d", i+1, c.ID, exp.Level(c.XP))
+ sb.WriteString(ft)
if i != len(tops)-1 {
- msg += "\n"
+ sb.WriteString("\n")
}
}
- return msg
+ return sb.String()
}