From c80a5de0421b812168e3983d59d892850e95eb4a Mon Sep 17 00:00:00 2001 From: barbequeorbarbecue <151953193+barbequeorbarbecue@users.noreply.github.com> Date: Sat, 12 Oct 2024 22:39:52 +0300 Subject: [PATCH] fix: category filter condition_type is not updated when condition_type value is 0 --- apps/discord-bot/internal/command/settwitch.go | 8 ++++---- apps/discord-bot/internal/service/service.go | 1 + apps/discord-bot/internal/service/streamer/streamer.go | 2 +- db/postgresql/discord.go | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/discord-bot/internal/command/settwitch.go b/apps/discord-bot/internal/command/settwitch.go index ab5d389f..79769d65 100644 --- a/apps/discord-bot/internal/command/settwitch.go +++ b/apps/discord-bot/internal/command/settwitch.go @@ -366,9 +366,9 @@ func SetTwitchCommandMetadata() *discordgo.ApplicationCommand { // set-twitch announcement category-filter { Name: "category-filter", - Description: "Filtering Discord channel-specific Twitch stream category for announcement. (?i)Just Chatting", + Description: "Filtering Discord channel-specific Twitch stream category for announcement (case-sensitive). Just Chatting", DescriptionLocalizations: map[discordgo.Locale]string{ - discordgo.Turkish: "Discord kanalına özgü yayın duyurularının filtrelenmesi. (?i)Just Chatting", + discordgo.Turkish: "Discord kanalına özgü yayın duyurularının filtrelenmesi (büyük/küçük harf duyarlı). Just Chatting", }, Type: discordgo.ApplicationCommandOptionSubCommand, Options: []*discordgo.ApplicationCommandOption{ @@ -388,9 +388,9 @@ func SetTwitchCommandMetadata() *discordgo.ApplicationCommand { { Type: discordgo.ApplicationCommandOptionString, Name: "regex", - Description: "RegEx string. For example: (?i)Just Chatting", + Description: "RegEx string. For example(case-sensitive): Just Chatting", DescriptionLocalizations: map[discordgo.Locale]string{ - discordgo.Turkish: "RegEx dizesi. Örneğin: (?i)Just Chatting", + discordgo.Turkish: "RegEx dizesi. Örneğin(büyük/küçük harf duyarlı): Just Chatting", }, Required: true, }, diff --git a/apps/discord-bot/internal/service/service.go b/apps/discord-bot/internal/service/service.go index 62a23f6d..3b8c71ef 100644 --- a/apps/discord-bot/internal/service/service.go +++ b/apps/discord-bot/internal/service/service.go @@ -218,6 +218,7 @@ func (s *service) DeleteDiscordTwitchLiveAnnosByGuildId(ctx context.Context, ser return s.DB.DeleteDiscordTwitchLiveAnnosByGuildId(ctx, serverId) } func (s *service) DeleteDiscordTwitchLiveAnnosByChannelId(ctx context.Context, channelId string) (bool, error) { + // TODO: Delete streamers from streamers data return s.DB.DeleteDiscordTwitchLiveAnnosByChannelId(ctx, channelId) } func (s *service) GetDiscordChannelTwitchCategoryFilter(ctx context.Context, serverId string, channelId string) ([]*model.DiscordChannelTwitchCategoryFilter, error) { diff --git a/apps/discord-bot/internal/service/streamer/streamer.go b/apps/discord-bot/internal/service/streamer/streamer.go index 108b0742..2bc8847f 100644 --- a/apps/discord-bot/internal/service/streamer/streamer.go +++ b/apps/discord-bot/internal/service/streamer/streamer.go @@ -94,7 +94,7 @@ func DeleteServerFromData(serverId string) bool { func GetTwitchUserInfo(twitchUsername string) (string, *model.TwitchUserInfo) { userInfo, err := twsrvc.GetTwitchUserInfo("login", twitchUsername) if err != nil { - log.Println("[GetTwitchUserInfo] twsrvc.GetTwitchUserInfo error:", err.Error()) + log.Println("[GetTwitchUserInfo] twsrvc.GetTwitchUserInfo (login: "+twitchUsername+") error:", err.Error()) //return fmt.Sprintf("`%v` kullanıcı adlı Twitch yayıncısı Twitch'te bulunamadı.", twitchUsername), nil return "Twitch streamer with username `" + twitchUsername + "` was not found.", nil } diff --git a/db/postgresql/discord.go b/db/postgresql/discord.go index 28db4508..6356b8f0 100644 --- a/db/postgresql/discord.go +++ b/db/postgresql/discord.go @@ -397,7 +397,7 @@ func (m *postgresql) SetDiscordChannelTwitchCategoryFilter(ctx context.Context, return false, errors.New("(SetDiscordChannelTwitchCategoryFilter) GetDiscordChannelTwitchCategoryFilter Error:" + err.Error()) } if len(dcTwitchCF) > 0 { - result := m.DB.Model(&dcTwitchCF).Updates(model.DiscordChannelTwitchCategoryFilter{ + result := m.DB.Model(&dcTwitchCF).Select("anno_server_id", "anno_channel_id", "category_filter_regex", "condition_type").Updates(model.DiscordChannelTwitchCategoryFilter{ AnnoChannelID: annoChannelId, AnnoServerID: annoServerId, CategoryFilterRegex: categoryFilterRegex,