2
0
mirror of https://github.com/42wim/matterbridge synced 2024-11-03 15:40:24 +00:00

Add URL to message in webhook if available (mattermost). See #356

This commit is contained in:
Wim 2018-01-31 17:35:13 +01:00
parent 62d1af8c37
commit 64a20ee61b

View File

@ -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)