From 6e92feaba23a4992e0ec4b529660921a6bcb492a Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Sun, 8 Mar 2026 18:51:05 +0100 Subject: feat(config): leave gorm --- commands/top.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'commands/top.go') 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() } -- cgit v1.2.3