diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index ce4f4c33..cdc62810 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -3,6 +3,7 @@ package bmattermost import ( "errors" "fmt" + "regexp" "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" @@ -98,6 +99,10 @@ func (b *Bmattermost) Send(msg config.Message) (string, error) { } b.Log.Debugf("=> Receiving %#v", msg) + // Strip IRC colors sent to Mattermost + re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`) + msg.Text = re.ReplaceAllString(msg.Text, "") + // Make a action /me of the message if msg.Event == config.EventUserAction { msg.Text = "*" + msg.Text + "*"