diff options
Diffstat (limited to 'config')
| -rw-r--r-- | config/channel.go | 4 | ||||
| -rw-r--r-- | config/guild.go | 6 | ||||
| -rw-r--r-- | config/xp_reduce.go | 8 | ||||
| -rw-r--r-- | config/xp_role.go | 40 |
4 files changed, 29 insertions, 29 deletions
diff --git a/config/channel.go b/config/channel.go index 1ee6974..0c25b25 100644 --- a/config/channel.go +++ b/config/channel.go @@ -29,7 +29,7 @@ func HandleModifyFallbackChannel(s bot.Session, i *event.InteractionCreate, data cfg.FallbackChannel = channelID err := cfg.Save() if err != nil { - s.LogError(err, "Saving fallback channel") + s.Logger().Error("saving fallback channel", "error", err) return false } return true @@ -40,7 +40,7 @@ func HandleModifyDisChannel(s bot.Session, i *event.InteractionCreate, data *int cfg.DisabledChannels = strings.Join(data.Values, ";") err := cfg.Save() if err != nil { - s.LogError(err, "Unable to save disabled channel") + s.Logger().Error("unable to save disabled channel", "error", err) return false } return true diff --git a/config/guild.go b/config/guild.go index 10c64fd..e046ca7 100644 --- a/config/guild.go +++ b/config/guild.go @@ -38,15 +38,15 @@ func (cfg *GuildConfig) IsDisabled(s bot.Session, channelID string) bool { ok = !strings.Contains(cfg.DisabledChannels, channelID) c, err := s.ChannelAPI().State.Channel(channelID) if err != nil { - s.LogError(err, "unable to find channel %s in state", c) + s.Logger().Error("unable to find channel %s in state", "error", err, "channel", c) c, err = s.ChannelAPI().Channel(channelID) if err == nil { err = s.ChannelAPI().State.ChannelAdd(c) if err != nil { - s.LogError(err, "unable to add channel %s to state", c) + s.Logger().Error("unable to add channel to state", "error", err, "channel", c) } } else { - s.LogError(err, "unable to fetch channel %s", s) + s.Logger().Error("unable to fetch channel", "error", err, "channel", c) return false } } diff --git a/config/xp_reduce.go b/config/xp_reduce.go index c3a3e10..389043d 100644 --- a/config/xp_reduce.go +++ b/config/xp_reduce.go @@ -45,7 +45,7 @@ func HandleModifyPeriodicReduceCommand(s bot.Session, i *event.InteractionCreate } err := s.InteractionAPI().Respond(i.Interaction, &response) if err != nil { - s.LogError(err, "Sending xp reduce modal") + s.Logger().Error("sending xp reduce modal", "error", err) } } @@ -55,14 +55,14 @@ func HandleTimeReduceSet(s bot.Session, i *event.InteractionCreate, data *intera if err != nil { err = resp.IsEphemeral().SetMessage(fmt.Sprintf("La valeur indiquée, `%s`, c'est pas un entier.", v)).Send() if err != nil { - s.LogError(err, "Sending bad input message") + s.Logger().Error("sending bad input message", "error", err) } return false } if days < 30 { err = resp.IsEphemeral().SetMessage("Le nombre de jours doit être suppérieur à 30.").Send() if err != nil { - s.LogError(err, "Sending less than 30 days message") + s.Logger().Error("sending less than 30 days message", "error", err) } return false } @@ -70,7 +70,7 @@ func HandleTimeReduceSet(s bot.Session, i *event.InteractionCreate, data *intera cfg.DaysXPRemains = uint(days) err = cfg.Save() if err != nil { - s.LogError(err, "Saving DaysXPRemains configuration") + s.Logger().Error("saving DaysXPRemains configuration", "error", err) return false } return true diff --git a/config/xp_role.go b/config/xp_role.go index 42fe9f4..f857289 100644 --- a/config/xp_role.go +++ b/config/xp_role.go @@ -92,7 +92,7 @@ func HandleXpRole( } err := s.InteractionAPI().Respond(i.Interaction, response) if err != nil { - s.LogError(err, "Sending config") + s.Logger().Error("sending config", "error", err) } } @@ -134,7 +134,7 @@ func HandleXpRoleNew( } err := s.InteractionAPI().Respond(i.Interaction, response) if err != nil { - s.LogError(err, "Sending modal to add") + s.Logger().Error("sending modal to add", "error", err) } } @@ -147,7 +147,7 @@ func HandleXpRoleEdit( config := GetGuildConfig(i.GuildID) id, err := getRoleLevelID(parameters) if err != nil { - s.LogError(err, "Reading dynamic CustomID") + s.Logger().Error("reading dynamic CustomID", "error", err) return } _, role := config.FindXpRoleID(id) @@ -199,7 +199,7 @@ func HandleXpRoleEdit( err = s.InteractionAPI().Respond(i.Interaction, response) if err != nil { - s.LogError(err, "Sending xp_role config") + s.Logger().Error("sending xp_role config", "error", err) } } @@ -211,7 +211,7 @@ func HandleXpRoleEditRole( ) { id, err := getRoleLevelID(parameters) if err != nil { - s.LogError(err, "Reading dynamic CustomID") + s.Logger().Error("reading dynamic CustomID", "error", err) return } role := data.Values[0] @@ -226,14 +226,14 @@ func HandleXpRoleEditRole( }, }) if err != nil { - s.LogError(err, "Sending unable to get role message") + s.Logger().Error("sending unable to get role message", "error", err) } return } xpRole.RoleID = role err = gokord.DB.Save(xpRole).Error if err != nil { - s.LogError(err, "Saving config guild_id %s, id %d, type add", i.GuildID, id) + s.Logger().Error("saving config", "error", err, "guild", i.GuildID, "id", id, "type", "add") } HandleXpRoleEdit(s, i, &interaction.MessageComponentData{}, parameters, resp) } @@ -247,7 +247,7 @@ func HandleXpRoleEditLevelStart( ) { id, err := getRoleLevelID(parameters) if err != nil { - s.LogError(err, "Reading dynamic CustomID") + s.Logger().Error("reading dynamic CustomID", "error", err) return } cfg := GetGuildConfig(i.GuildID) @@ -261,7 +261,7 @@ func HandleXpRoleEditLevelStart( }, }) if err != nil { - s.LogError(err, "Sending Unable to get role message") + s.Logger().Error("sending unable to get role message", "error", err) } return } @@ -288,7 +288,7 @@ func HandleXpRoleEditLevelStart( } err = s.InteractionAPI().Respond(i.Interaction, response) if err != nil { - s.LogError(err, "Sending Edit level modal") + s.Logger().Error("sending edit level modal", "error", err) } } @@ -301,7 +301,7 @@ func HandleXpRoleEditLevel( ) { id, err := getRoleLevelID(parameters) if err != nil { - s.LogError(err, "Reading dynamic CustomID") + s.Logger().Error("reading dynamic CustomID", "error", err) return } @@ -315,7 +315,7 @@ func HandleXpRoleEditLevel( ). Send() if err != nil { - s.LogError(err, "Sending bad number warning message") + s.Logger().Error("sending bad number warning message", "error", err) } return } @@ -332,14 +332,14 @@ func HandleXpRoleEditLevel( }, }) if err != nil { - s.LogError(err, "Sending unable to modify role message") + s.Logger().Error("sending unable to modify role message", "error", err) } return } xpRole.XP = xp err = gokord.DB.Save(xpRole).Error if err != nil { - s.LogError(err, "Saving config guild_id %s, id %d, type add", i.GuildID, id) + s.Logger().Error("saving config", "guild", i.GuildID, "id", id, "type", "edit") } HandleXpRoleEdit(s, i, &interaction.MessageComponentData{}, parameters, resp) } @@ -353,13 +353,13 @@ func HandleXpRoleDel( ) { id, err := getRoleLevelID(dynamicValues) if err != nil { - s.LogError(err, "reading dynamic CustomID") + s.Logger().Error("reading dynamic CustomID", "error", err) return } cfg := GetGuildConfig(i.GuildID) _, role := cfg.FindXpRoleID(id) if role == nil { - err := s.InteractionAPI().Respond(i.Interaction, &interaction.Response{ + err = s.InteractionAPI().Respond(i.Interaction, &interaction.Response{ Type: types.InteractionResponseChannelMessageWithSource, Data: &interaction.ResponseData{ Content: "Rôle introuvable. Peut-être a-t-il déjà été supprimé ?", @@ -367,13 +367,13 @@ func HandleXpRoleDel( }, }) if err != nil { - s.LogError(err, "Sending role not found message") + s.Logger().Error("sending role not found message", "error", err) } return } err = gokord.DB.Delete(role).Error if err != nil { - s.LogError(err, "Deleting entry guild_id %s, id %d, type del", i.GuildID, id) + s.Logger().Error("deleting entry", "error", err, "guild", i.GuildID, "id", id, "type", "del") } HandleXpRole(s, i, &interaction.MessageComponentData{}, resp) @@ -395,7 +395,7 @@ func HandleXpRoleAdd( ). Send() if err != nil { - s.LogError(err, "sending bad number warning message") + s.Logger().Error("sending bad number warning message", "error", err) } return } @@ -410,7 +410,7 @@ func HandleXpRoleAdd( }) err = cfg.Save() if err != nil { - s.LogError(err, "saving config for role %s in %s", roleId, i.GuildID) + s.Logger().Error("saving config", "error", err, "role", roleId, "guild", i.GuildID) return } |
