diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go index f76c4ab8..e7232b7d 100644 --- a/bridge/matrix/matrix.go +++ b/bridge/matrix/matrix.go @@ -8,6 +8,7 @@ import ( "regexp" "strings" "sync" + "regexp" "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" @@ -74,6 +75,10 @@ func (b *Bmatrix) Send(msg config.Message) (string, error) { channel := b.getRoomID(msg.Channel) b.Log.Debugf("Channel %s maps to channel id %s", msg.Channel, channel) + // Strip IRC colors sent to Matrix + 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 { m := matrix.TextMessage{