summaryrefslogtreecommitdiffstats
path: root/bridge/slack/handlers.go
diff options
context:
space:
mode:
authorPatrick Connolly <patrick.c.connolly@gmail.com>2018-11-26 17:47:04 +0800
committerDuco van Amstel <duco.vanamstel@gmail.com>2018-11-26 09:47:04 +0000
commitf5659d455d2c28a6f2fe4c40f4dc344419ff523a (patch)
tree76447e104bfafeea83f3df6cf7f540d7c0bf048c /bridge/slack/handlers.go
parent5ed7abdbeb8a81599b3516583e15df75651fb9bc (diff)
downloadmatterbridge-msglm-f5659d455d2c28a6f2fe4c40f4dc344419ff523a.tar.gz
matterbridge-msglm-f5659d455d2c28a6f2fe4c40f4dc344419ff523a.tar.bz2
matterbridge-msglm-f5659d455d2c28a6f2fe4c40f4dc344419ff523a.zip
Sync channel topics between Slack bridges (#585)
Added logic to allow for configurable synchronisation of topics and purposes of channels between Slack bridges.
Diffstat (limited to 'bridge/slack/handlers.go')
-rw-r--r--bridge/slack/handlers.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/bridge/slack/handlers.go b/bridge/slack/handlers.go
index 035c5af5..89c800da 100644
--- a/bridge/slack/handlers.go
+++ b/bridge/slack/handlers.go
@@ -116,6 +116,11 @@ func (b *Bslack) skipMessageEvent(ev *slack.MessageEvent) bool {
return b.GetBool(noSendJoinConfig)
case sPinnedItem, sUnpinnedItem:
return true
+ case sChannelTopic, sChannelPurpose:
+ // Skip the event if our bot/user account changed the topic/purpose
+ if ev.User == b.si.User.ID {
+ return true
+ }
}
// Skip any messages that we made ourselves or from 'slackbot' (see #527).
@@ -136,7 +141,6 @@ func (b *Bslack) skipMessageEvent(ev *slack.MessageEvent) bool {
if len(ev.Files) > 0 {
return b.filesCached(ev.Files)
}
-
return false
}
@@ -201,6 +205,7 @@ func (b *Bslack) handleStatusEvent(ev *slack.MessageEvent, rmsg *config.Message)
rmsg.Username = sSystemUser
rmsg.Event = config.EventJoinLeave
case sChannelTopic, sChannelPurpose:
+ b.populateChannels()
rmsg.Event = config.EventTopicChange
case sMessageChanged:
rmsg.Text = ev.SubMessage.Text