diff options
Diffstat (limited to 'commands')
| -rw-r--r-- | commands/config.go | 8 | ||||
| -rw-r--r-- | commands/deploy.go | 2 | ||||
| -rw-r--r-- | commands/stats.go | 2 | ||||
| -rw-r--r-- | commands/top.go | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/commands/config.go b/commands/config.go index 37aa953..f2dcf60 100644 --- a/commands/config.go +++ b/commands/config.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "slices" + "strconv" "strings" "git.anhgelus.world/anhgelus/les-copaings-bot/config" @@ -20,7 +21,7 @@ const ( OpenConfig = "config" ) -func ConfigResponse(ctx context.Context, guildID string) *interaction.Response { +func ConfigResponse(ctx context.Context, guildID uint64) *interaction.Response { cfg := config.GetGuildConfig(ctx, guildID) roles := "" l := len(cfg.XpRoles) - 1 @@ -41,14 +42,15 @@ func ConfigResponse(ctx context.Context, guildID string) *interaction.Response { var disChansDefault []component.SelectMenuDefaultValue for _, c := range disChans { if c != "" { + v, _ := strconv.ParseUint(c, 10, 64) disChansDefault = append(disChansDefault, component.SelectMenuDefaultValue{ - ID: c, + ID: v, Type: types.SelectMenuDefaultValueChannel, }) } } var defaultChan []component.SelectMenuDefaultValue - if len(cfg.FallbackChannel) > 0 { + if cfg.FallbackChannel != 0 { defaultChan = append(defaultChan, component.SelectMenuDefaultValue{ ID: cfg.FallbackChannel, Type: types.SelectMenuDefaultValueChannel, diff --git a/commands/deploy.go b/commands/deploy.go index 7b039f2..0890cf8 100644 --- a/commands/deploy.go +++ b/commands/deploy.go @@ -68,7 +68,7 @@ func init() { } func Deploy(ctx context.Context, dg bot.Session) error { - guildID := "" + var guildID uint64 if common.IsDebug(ctx) { guildID = dg.GuildState().ListGuilds()[0] bot.Logger(ctx).Debug("using guild as debug", "guild", guildID) diff --git a/commands/stats.go b/commands/stats.go index 2cc0b3e..15f258b 100644 --- a/commands/stats.go +++ b/commands/stats.go @@ -118,7 +118,7 @@ func statsAll(ctx context.Context, dg bot.Session, i *interaction.ApplicationCom }) } -func statsMember(ctx context.Context, dg bot.Session, i *interaction.ApplicationCommand, days int, discordID string) (io.WriterTo, error) { +func statsMember(ctx context.Context, dg bot.Session, i *interaction.ApplicationCommand, days int, discordID uint64) (io.WriterTo, error) { _, err := guild.GetMember(i.GuildID, discordID).Do(ctx) if err != nil { return nil, err diff --git a/commands/top.go b/commands/top.go index aa0c288..82183a1 100644 --- a/commands/top.go +++ b/commands/top.go @@ -59,7 +59,7 @@ func Top(ctx context.Context, dg bot.Session, i *interaction.ApplicationCommand) func genTopsMessage(tops []user.CopaingCached) string { msg := "" for i, c := range tops { - msg += fmt.Sprintf("%d. **<@%s>** - niveau %d", i+1, c.DiscordID, exp.Level(c.XP)) + msg += fmt.Sprintf("%d. **<@%d>** - niveau %d", i+1, c.DiscordID, exp.Level(c.XP)) if i != len(tops)-1 { msg += "\n" } |
