mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-25 04:02:03 -08:00
Fix loop from webhook by adding matterbridge prop (mattermost). Closes #261
This commit is contained in:
parent
1a40b0c1e9
commit
47b7fae61b
@ -163,6 +163,9 @@ func (b *Bmattermost) Send(msg config.Message) (string, error) {
|
|||||||
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["matterbridge"] = true
|
||||||
err := b.mh.Send(matterMessage)
|
err := b.mh.Send(matterMessage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
flog.Info(err)
|
flog.Info(err)
|
||||||
@ -226,6 +229,10 @@ func (b *Bmattermost) handleMatterClient(mchan chan *MMMessage) {
|
|||||||
|
|
||||||
props := message.Post.Props
|
props := message.Post.Props
|
||||||
if props != nil {
|
if props != nil {
|
||||||
|
if _, ok := props["matterbridge"].(bool); ok {
|
||||||
|
flog.Debugf("sent by matterbridge, ignoring")
|
||||||
|
continue
|
||||||
|
}
|
||||||
if _, ok := props["override_username"].(string); ok {
|
if _, ok := props["override_username"].(string); ok {
|
||||||
message.Username = props["override_username"].(string)
|
message.Username = props["override_username"].(string)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user