Skip to content

Commit

Permalink
chore: fwd PR msg in random channel to brainery log
Browse files Browse the repository at this point in the history
  • Loading branch information
lmquang committed Nov 4, 2024
1 parent 295e0a2 commit 5409cb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type DiscordIds struct {
DwarvesGuild string
RepostDoneChannel string
RandomChannel string
BraineryChannel string
DevChannel string
}

Expand Down Expand Up @@ -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"),
Expand Down
7 changes: 5 additions & 2 deletions pkg/discord/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5409cb4

Please sign in to comment.