summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-06-16 00:11:15 +0200
committerWim <wim@42.be>2018-06-16 00:11:15 +0200
commitd2c02be3a00f1e0f05f1ed089dfa8b3e5a0a5538 (patch)
treef72ab4272a1e17f53aab35ec4a54808f24a92c88
parent594492fbddd930c04184a848fbb73866274fbae6 (diff)
downloadmatterbridge-msglm-d2c02be3a00f1e0f05f1ed089dfa8b3e5a0a5538.tar.gz
matterbridge-msglm-d2c02be3a00f1e0f05f1ed089dfa8b3e5a0a5538.tar.bz2
matterbridge-msglm-d2c02be3a00f1e0f05f1ed089dfa8b3e5a0a5538.zip
Handle slack attachments sent to mattermost. Closes #447
-rw-r--r--bridge/mattermost/mattermost.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go
index 14c71af4..d828c4d1 100644
--- a/bridge/mattermost/mattermost.go
+++ b/bridge/mattermost/mattermost.go
@@ -221,6 +221,18 @@ func (b *Bmattermost) handleMatterClient(messages chan *config.Message) {
}
if _, ok := props["attachments"].([]interface{}); ok {
rmsg.Extra["attachments"] = props["attachments"].([]interface{})
+ if rmsg.Text == "" {
+ for _, attachment := range rmsg.Extra["attachments"] {
+ attach := attachment.(map[string]interface{})
+ if attach["text"].(string) != "" {
+ rmsg.Text += attach["text"].(string)
+ continue
+ }
+ if attach["fallback"].(string) != "" {
+ rmsg.Text += attach["fallback"].(string)
+ }
+ }
+ }
}
}