Strip IRC colors sent to Mattermost
This commit is contained in:
@@ -3,6 +3,7 @@ package bmattermost
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
"github.com/42wim/matterbridge/bridge"
|
||||
"github.com/42wim/matterbridge/bridge/config"
|
||||
@@ -98,6 +99,10 @@ func (b *Bmattermost) Send(msg config.Message) (string, error) {
|
||||
}
|
||||
b.Log.Debugf("=> Receiving %#v", msg)
|
||||
|
||||
// Strip IRC colors sent to Mattermost
|
||||
re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`)
|
||||
msg.Text = re.ReplaceAllString(msg.Text, "")
|
||||
|
||||
// Make a action /me of the message
|
||||
if msg.Event == config.EventUserAction {
|
||||
msg.Text = "*" + msg.Text + "*"
|
||||
|
||||
Reference in New Issue
Block a user