From eee2a3873e11bef6bee2f71cf429c8a870c5383c Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Thu, 22 Jan 2026 19:23:41 +0100 Subject: refactor(events): use new handlers --- config/channel.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'config/channel.go') diff --git a/config/channel.go b/config/channel.go index 0c25b25..6086f09 100644 --- a/config/channel.go +++ b/config/channel.go @@ -1,11 +1,10 @@ package config import ( + "context" "strings" - "github.com/anhgelus/gokord/cmd" "github.com/nyttikord/gokord/bot" - "github.com/nyttikord/gokord/event" "github.com/nyttikord/gokord/interaction" ) @@ -20,27 +19,27 @@ const ( DisChannelDelSet = "disabled_channel_del_set" ) -func HandleModifyFallbackChannel(s bot.Session, i *event.InteractionCreate, data *interaction.MessageComponentData, _ *cmd.ResponseBuilder) bool { +func HandleModifyFallbackChannel(ctx context.Context, dg bot.Session, i *interaction.MessageComponent) bool { cfg := GetGuildConfig(i.GuildID) var channelID string - if len(data.Values) > 0 { - channelID = data.Values[0] + if len(i.Data.Values) > 0 { + channelID = i.Data.Values[0] } cfg.FallbackChannel = channelID err := cfg.Save() if err != nil { - s.Logger().Error("saving fallback channel", "error", err) + bot.Logger(ctx).Error("saving fallback channel", "error", err) return false } return true } -func HandleModifyDisChannel(s bot.Session, i *event.InteractionCreate, data *interaction.MessageComponentData, _ *cmd.ResponseBuilder) bool { +func HandleModifyDisChannel(ctx context.Context, dg bot.Session, i *interaction.MessageComponent) bool { cfg := GetGuildConfig(i.GuildID) - cfg.DisabledChannels = strings.Join(data.Values, ";") + cfg.DisabledChannels = strings.Join(i.Data.Values, ";") err := cfg.Save() if err != nil { - s.Logger().Error("unable to save disabled channel", "error", err) + bot.Logger(ctx).Error("unable to save disabled channel", "error", err) return false } return true -- cgit v1.2.3