Strip IRC colors sent to Discord

This commit is contained in:
chotaire
2019-04-17 03:19:31 +02:00
parent fd79eac291
commit 93f8e6e032

View File

@@ -187,6 +187,10 @@ func (b *Bdiscord) Send(msg config.Message) (string, error) {
return "", fmt.Errorf("Could not find channelID for %v", msg.Channel)
}
// Strip IRC colors sent to Discord
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 + "_"