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