mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-22 14:00:27 +00: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.Type = ""
|
||||
matterMessage.Text = message
|
||||
matterMessage.Text = message
|
||||
matterMessage.Props = make(map[string]interface{})
|
||||
matterMessage.Props["matterbridge"] = true
|
||||
err := b.mh.Send(matterMessage)
|
||||
if err != nil {
|
||||
flog.Info(err)
|
||||
@ -226,6 +229,10 @@ func (b *Bmattermost) handleMatterClient(mchan chan *MMMessage) {
|
||||
|
||||
props := message.Post.Props
|
||||
if props != nil {
|
||||
if _, ok := props["matterbridge"].(bool); ok {
|
||||
flog.Debugf("sent by matterbridge, ignoring")
|
||||
continue
|
||||
}
|
||||
if _, ok := props["override_username"].(string); ok {
|
||||
message.Username = props["override_username"].(string)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user