Strip IRC colors sent to Slack
This commit is contained in:
@@ -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 + "_"
|
||||
|
||||
Reference in New Issue
Block a user