Strip IRC colors sent to Slack

This commit is contained in:
chotaire
2019-04-17 03:26:35 +02:00
parent fad2c22317
commit bb4c835e96

View File

@@ -7,6 +7,7 @@ import (
"strings"
"sync"
"time"
"regexp"
"github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config"
@@ -181,6 +182,10 @@ func (b *Bslack) Send(msg config.Message) (string, error) {
msg.Text = b.replaceCodeFence(msg.Text)
// Strip IRC colors sent to Slack
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 + "_"