mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-26 08:51:35 +00:00
Add URL to message in webhook if available (mattermost). See #356
This commit is contained in:
parent
62d1af8c37
commit
64a20ee61b
@ -152,13 +152,24 @@ func (b *Bmattermost) Send(msg config.Message) (string, error) {
|
|||||||
message = nick + message
|
message = nick + message
|
||||||
}
|
}
|
||||||
if b.Config.WebhookURL != "" {
|
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 := matterhook.OMessage{IconURL: b.Config.IconURL}
|
||||||
matterMessage.IconURL = msg.Avatar
|
matterMessage.IconURL = msg.Avatar
|
||||||
matterMessage.Channel = channel
|
matterMessage.Channel = channel
|
||||||
matterMessage.UserName = nick
|
matterMessage.UserName = nick
|
||||||
matterMessage.Type = ""
|
matterMessage.Type = ""
|
||||||
matterMessage.Text = message
|
matterMessage.Text = message
|
||||||
matterMessage.Text = message
|
|
||||||
matterMessage.Props = make(map[string]interface{})
|
matterMessage.Props = make(map[string]interface{})
|
||||||
matterMessage.Props["matterbridge"] = true
|
matterMessage.Props["matterbridge"] = true
|
||||||
err := b.mh.Send(matterMessage)
|
err := b.mh.Send(matterMessage)
|
||||||
|
Loading…
Reference in New Issue
Block a user