From 2d2d185200278ff9453c69be60cff13e1bec6e2c Mon Sep 17 00:00:00 2001 From: John <7192933+qtaf@users.noreply.github.com> Date: Wed, 11 Jul 2018 16:50:49 -0400 Subject: [PATCH] Stop numbers being stripped after non-color control codes (irc) (#465) Currently numbers are stripped not just after the color control code (\x03) but also after other formatting such as bold (\x02) and italic (\x1D), which is both unnecessary and leads to missing text from irc. This fixes that by only stripping numbers after the color control code. --- bridge/irc/irc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go index fe1e0d3b..5b1d74eb 100644 --- a/bridge/irc/irc.go +++ b/bridge/irc/irc.go @@ -397,7 +397,7 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) { rmsg.Text += event.StripAction() // strip IRC colors - re := regexp.MustCompile(`[[:cntrl:]](?:\d{1,2}(?:,\d{1,2})?)?`) + re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`) rmsg.Text = re.ReplaceAllString(rmsg.Text, "") // start detecting the charset