Strip IRC colors sent to Telegram

This commit is contained in:
chotaire
2019-04-17 03:33:21 +02:00
parent c8a2e7d7e1
commit a156513b8c

View File

@@ -4,6 +4,7 @@ import (
"html"
"strconv"
"strings"
"regexp"
"github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config"
@@ -91,6 +92,10 @@ func (b *Btelegram) Send(msg config.Message) (string, error) {
}
}
// Strip IRC colors sent to Telegram
re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`)
msg.Text = re.ReplaceAllString(msg.Text, "")
// edit the message if we have a msg ID
if msg.ID != "" {
return b.handleEdit(&msg, chatid)