Skip to content

Commit c3c30a2

Browse files
committed
fix the discord/slack integrations not sending messages b/c each others channels are overflowing
1 parent 30ee6cd commit c3c30a2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

discord.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ func discordMessageHandler(_ *discordgo.Session, m *discordgo.MessageCreate) {
148148

149149
msgContent := strings.TrimSpace(m.ContentWithMentionsReplaced())
150150
if Integrations.Slack != nil {
151-
SlackChan <- Integrations.Discord.Prefix + " " + name + ": " + msgContent // send this discord message to slack
151+
select {
152+
case SlackChan <- Integrations.Discord.Prefix + " " + name + ": " + msgContent: // send this discord message to slack
153+
default:
154+
Log.Println("Overflow in Slack channel")
155+
}
152156
}
153157
runCommands(msgContent, DiscordUser)
154158
}

slack.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ func getMsgsFromSlack() {
4848
name := strings.Fields(u.RealName)[0]
4949
uslack.Name = Yellow.Paint(Integrations.Slack.Prefix+" ") + (Styles[int(i)%len(Styles)]).apply(name)
5050
if Integrations.Discord != nil {
51-
DiscordChan <- DiscordMsg{
51+
select {
52+
case DiscordChan <- DiscordMsg{
5253
senderName: Integrations.Slack.Prefix + " " + name,
5354
msg: text,
5455
channel: uslack.room.name,
55-
} // send this discord message to slack
56+
}: // send this discord message to slack
57+
default:
58+
Log.Println("Overflow in Discord channel")
59+
}
5660
}
5761
runCommands(text, uslack)
5862
case *slack.ConnectedEvent:

0 commit comments

Comments
 (0)