diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-01-22 20:10:21 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-01-22 20:10:21 +0100 |
| commit | 8255a2e51454049f3ac1532f6e1125f528691c37 (patch) | |
| tree | 064b7dbdd07efd85162c954d20c1dcd831ea84f6 /config/guild.go | |
| parent | eee2a3873e11bef6bee2f71cf429c8a870c5383c (diff) | |
refactor(commands): use new handlers
Diffstat (limited to 'config/guild.go')
| -rw-r--r-- | config/guild.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/config/guild.go b/config/guild.go index 8799186..c1df2c9 100644 --- a/config/guild.go +++ b/config/guild.go @@ -1,6 +1,7 @@ package config import ( + "context" "strings" "github.com/anhgelus/gokord" @@ -51,21 +52,21 @@ func (cfg *GuildConfig) Save() error { return gokord.DB.Save(cfg).Error } -func (cfg *GuildConfig) IsDisabled(s bot.Session, channelID string) bool { +func (cfg *GuildConfig) IsDisabled(ctx context.Context, s bot.Session, channelID string) bool { ok := true for channelID != "" && ok { ok = !strings.Contains(cfg.DisabledChannels, channelID) c, err := s.ChannelAPI().State.Channel(channelID) if err != nil { - s.Logger().Error("unable to find channel %s in state", "error", err, "channel", c) - c, err = s.ChannelAPI().Channel(channelID) + bot.Logger(ctx).Error("unable to find channel %s in state", "error", err, "channel", c) + c, err = s.ChannelAPI().Channel(channelID).Do(ctx) if err == nil { err = s.ChannelAPI().State.ChannelAdd(c) if err != nil { - s.Logger().Error("unable to add channel to state", "error", err, "channel", c) + bot.Logger(ctx).Error("unable to add channel to state", "error", err, "channel", c) } } else { - s.Logger().Error("unable to fetch channel", "error", err, "channel", c) + bot.Logger(ctx).Error("unable to fetch channel", "error", err, "channel", c) return false } } |
