From 73501739d5527f1d76dbde10e79e409a1c78d630 Mon Sep 17 00:00:00 2001
From: Wim <wim@42.be>
Date: Sun, 25 Nov 2018 00:34:14 +0100
Subject: Do not post empty messages (slack). Fixes #574

---
 bridge/slack/slack.go | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'bridge/slack')

diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index 4251f83b..d5a6084b 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -357,6 +357,10 @@ func (b *Bslack) editMessage(msg *config.Message, channelInfo *slack.Channel) (b
 }
 
 func (b *Bslack) postMessage(msg *config.Message, messageParameters *slack.PostMessageParameters, channelInfo *slack.Channel) (string, error) {
+	// don't post empty messages
+	if msg.Text == "" {
+		return "", nil
+	}
 	for {
 		_, id, err := b.rtm.PostMessage(channelInfo.ID, msg.Text, *messageParameters)
 		if err == nil {
-- 
cgit v1.2.3