From 5409cb42f334e5d6bef73ace1df8be36b1975fc6 Mon Sep 17 00:00:00 2001 From: Quang Le Date: Mon, 4 Nov 2024 11:08:36 +0700 Subject: [PATCH] chore: fwd PR msg in random channel to brainery log --- pkg/config/config.go | 2 ++ pkg/discord/listener.go | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 2871e2d..bedfac8 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -56,6 +56,7 @@ type DiscordIds struct { DwarvesGuild string RepostDoneChannel string RandomChannel string + BraineryChannel string DevChannel string } @@ -100,6 +101,7 @@ func Generate(v ENV) *Config { DwarvesGuild: v.GetString("DISCORD_ID_DWARVES_GUILD"), RepostDoneChannel: v.GetString("DISCORD_ID_REPOST_DONE"), RandomChannel: v.GetString("DISCORD_ID_RANDOM_CHANNEL"), + BraineryChannel: v.GetString("DISCORD_ID_BRAINERY_CHANNEL"), DevChannel: v.GetString("DISCORD_ID_DEV_CHANNEL"), }, WhiteListedChannels: v.GetString("DISCORD_WHITELISTED_CHANNELS"), diff --git a/pkg/discord/listener.go b/pkg/discord/listener.go index 9126579..8c5c36e 100644 --- a/pkg/discord/listener.go +++ b/pkg/discord/listener.go @@ -177,10 +177,13 @@ func (d *Discord) forwardPullRequestMessage(s *discordgo.Session, m *discordgo.M } // Send the message to the "random" channel - _, err := s.ChannelMessageSendComplex(d.Cfg.Discord.ID.RandomChannel, newMessage) - if err != nil { + if _, err := s.ChannelMessageSendComplex(d.Cfg.Discord.ID.RandomChannel, newMessage); err != nil { log.Printf("Error sending message to random channel: %v", err) } + // fwd message to brainery channel + if _, err := s.ChannelMessageSendComplex(d.Cfg.Discord.ID.BraineryChannel, newMessage); err != nil { + log.Printf("Error sending message to brainery channel: %v", err) + } } func getDiscordEmbedTitle(m *discordgo.Message) string {