diff options
author | Wim <wim@42.be> | 2018-01-31 17:35:13 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2018-01-31 17:35:13 +0100 |
commit | 64a20ee61b47e8df982152bfc87a8bb798f009d9 (patch) | |
tree | 0a7954778120e1fadb3cb0027376ab3962e54402 /bridge | |
parent | 62d1af8c37254ffe129624b9ad99039e93074336 (diff) | |
download | matterbridge-msglm-64a20ee61b47e8df982152bfc87a8bb798f009d9.tar.gz matterbridge-msglm-64a20ee61b47e8df982152bfc87a8bb798f009d9.tar.bz2 matterbridge-msglm-64a20ee61b47e8df982152bfc87a8bb798f009d9.zip |
Add URL to message in webhook if available (mattermost). See #356
Diffstat (limited to 'bridge')
-rw-r--r-- | bridge/mattermost/mattermost.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index 3ecaf6a5..e84e61f1 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -152,13 +152,24 @@ func (b *Bmattermost) Send(msg config.Message) (string, error) { message = nick + message } if b.Config.WebhookURL != "" { + + if msg.Extra != nil { + if len(msg.Extra["file"]) > 0 { + for _, f := range msg.Extra["file"] { + fi := f.(config.FileInfo) + if fi.URL != "" { + message += fi.URL + } + } + } + } + matterMessage := matterhook.OMessage{IconURL: b.Config.IconURL} matterMessage.IconURL = msg.Avatar matterMessage.Channel = channel matterMessage.UserName = nick matterMessage.Type = "" matterMessage.Text = message - matterMessage.Text = message matterMessage.Props = make(map[string]interface{}) matterMessage.Props["matterbridge"] = true err := b.mh.Send(matterMessage) |