diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-03-08 18:51:05 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-03-08 18:51:05 +0100 |
| commit | 6e92feaba23a4992e0ec4b529660921a6bcb492a (patch) | |
| tree | 05024b52d4c8ede041facdc48ac65af5ba0259da /commands/top.go | |
| parent | 3bcf74c47d1597ba650dc5a55868f83f5f547ad7 (diff) | |
feat(config): leave gorm
Diffstat (limited to 'commands/top.go')
| -rw-r--r-- | commands/top.go | 12 |
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() } |
