Strip IRC colors sent to Gitter

This commit is contained in:
chotaire
2019-04-17 03:24:07 +02:00
parent 3292f03528
commit fad2c22317

View File

@@ -3,6 +3,7 @@ package bgitter
import (
"fmt"
"strings"
"regexp"
"github.com/42wim/go-gitter"
"github.com/42wim/matterbridge/bridge"
@@ -98,6 +99,10 @@ func (b *Bgitter) Send(msg config.Message) (string, error) {
b.Log.Errorf("Could not find roomID for %v", msg.Channel)
return "", nil
}
// Strip IRC colors sent to Gitter
re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`)
msg.Text = re.ReplaceAllString(msg.Text, "")
// Delete message
if msg.Event == config.EventMsgDelete {