Strip IRC colors sent to Steam

This commit is contained in:
chotaire
2019-04-17 03:30:43 +02:00
parent ea4948728c
commit c8a2e7d7e1

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"sync"
"time"
"regexp"
"github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config"
@@ -67,6 +68,10 @@ func (b *Bsteam) Send(msg config.Message) (string, error) {
return "", err
}
// Strip IRC colors sent to Steam
re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`)
msg.Text = re.ReplaceAllString(msg.Text, "")
// Handle files
if msg.Extra != nil {
for _, rmsg := range helper.HandleExtra(&msg, b.General) {