summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-07-22 20:03:40 +0200
committerWim <wim@42.be>2017-07-22 20:03:40 +0200
commitbd97357f8d30322dc9c9745c47b9461d862844ba (patch)
tree87fcfcc2e068be823c8f9db796d212cacd836e22
parent10dab1366e023ba5327ffd8d262a1ff8121764a2 (diff)
downloadmatterbridge-msglm-bd97357f8d30322dc9c9745c47b9461d862844ba.tar.gz
matterbridge-msglm-bd97357f8d30322dc9c9745c47b9461d862844ba.tar.bz2
matterbridge-msglm-bd97357f8d30322dc9c9745c47b9461d862844ba.zip
Disable message from other bots when using webhooks (slack)
-rw-r--r--bridge/slack/slack.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index 72392a67..6617f823 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -222,6 +222,9 @@ func (b *Bslack) handleSlack() {
if b.Config.WebhookURL == "" && b.Config.WebhookBindAddress == "" && message.Username == b.si.User.Name {
continue
}
+ if message.Text == "" || message.Username == "" {
+ continue
+ }
texts := strings.Split(message.Text, "\n")
for _, text := range texts {
text = b.replaceURL(text)
@@ -279,7 +282,8 @@ func (b *Bslack) handleSlackClient(mchan chan *MMMessage) {
}
m.Raw = ev
m.Text = b.replaceMention(m.Text)
- if ev.BotID != "" {
+ // when using webhookURL we can't check if it's our webhook or not for now
+ if ev.BotID != "" && b.Config.WebhookURL == "" {
bot, err := b.rtm.GetBotInfo(ev.BotID)
if err != nil {
continue