diff --git a/bridge/whatsapp/whatsapp.go b/bridge/whatsapp/whatsapp.go index 286d463c..8649bdb4 100644 --- a/bridge/whatsapp/whatsapp.go +++ b/bridge/whatsapp/whatsapp.go @@ -8,6 +8,7 @@ import ( "os" "strings" "time" + "regexp" "github.com/42wim/matterbridge/bridge" "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) { 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 if msg.Event == config.EventMsgDelete { if msg.ID == "" {