Strip IRC colors sent to Whatsapp
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
"regexp"
|
||||||
|
|
||||||
"github.com/42wim/matterbridge/bridge"
|
"github.com/42wim/matterbridge/bridge"
|
||||||
"github.com/42wim/matterbridge/bridge/config"
|
"github.com/42wim/matterbridge/bridge/config"
|
||||||
@@ -243,6 +244,10 @@ func (b *Bwhatsapp) JoinChannel(channel config.ChannelInfo) error {
|
|||||||
func (b *Bwhatsapp) Send(msg config.Message) (string, error) {
|
func (b *Bwhatsapp) Send(msg config.Message) (string, error) {
|
||||||
b.Log.Debugf("=> Receiving %#v", msg)
|
b.Log.Debugf("=> Receiving %#v", msg)
|
||||||
|
|
||||||
|
// Strip IRC colors sent to Whatsapp
|
||||||
|
re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`)
|
||||||
|
msg.Text = re.ReplaceAllString(msg.Text, "")
|
||||||
|
|
||||||
// Delete message
|
// Delete message
|
||||||
if msg.Event == config.EventMsgDelete {
|
if msg.Event == config.EventMsgDelete {
|
||||||
if msg.ID == "" {
|
if msg.ID == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user