From 64a20ee61b47e8df982152bfc87a8bb798f009d9 Mon Sep 17 00:00:00 2001 From: Wim Date: Wed, 31 Jan 2018 17:35:13 +0100 Subject: Add URL to message in webhook if available (mattermost). See #356 --- bridge/mattermost/mattermost.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'bridge') 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) -- cgit v1.2.3