diff --git a/.gitignore b/.gitignore index 25b0ec3..785c0bc 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,4 @@ util/files gus.sh rathaus.sh run.sh +impact.ttf diff --git a/connectors/slackapp/slackApp.go b/connectors/slackapp/slackApp.go index 0ebc5c5..d711869 100644 --- a/connectors/slackapp/slackApp.go +++ b/connectors/slackapp/slackApp.go @@ -17,6 +17,8 @@ import ( "text/template" "time" + zerowidth "github.com/trubitsyn/go-zero-width" + "github.com/rs/zerolog/log" "github.com/slack-go/slack" @@ -419,6 +421,7 @@ func (s *SlackApp) buildMessage(m *slackevents.MessageEvent) msg.Message { // Slack likes to put these NBSP in and it screws with matching later text = strings.ReplaceAll(text, "\u00a0", " ") + text = zerowidth.RemoveZeroWidthCharacters(text) isCmd, text := bot.IsCmd(s.config, text) diff --git a/go.mod b/go.mod index ac3df17..09dee3b 100644 --- a/go.mod +++ b/go.mod @@ -54,6 +54,7 @@ require ( github.com/stretchr/objx v0.2.0 // indirect github.com/stretchr/testify v1.4.0 github.com/temoto/robotstxt v1.1.1 // indirect + github.com/trubitsyn/go-zero-width v1.0.1 // indirect github.com/ttacon/builder v0.0.0-20170518171403-c099f663e1c2 // indirect github.com/ttacon/libphonenumber v1.1.0 // indirect github.com/velour/chat v0.0.0-20180713122344-fd1d1606cb89 diff --git a/go.sum b/go.sum index 0220561..aa1d5c5 100644 --- a/go.sum +++ b/go.sum @@ -139,6 +139,8 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/temoto/robotstxt v1.1.1 h1:Gh8RCs8ouX3hRSxxK7B1mO5RFByQ4CmJZDwgom++JaA= github.com/temoto/robotstxt v1.1.1/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo= +github.com/trubitsyn/go-zero-width v1.0.1 h1:AAZhtyGXW79T5BouAF0R9FtDhGcp7IGbLZo2Id3N+m8= +github.com/trubitsyn/go-zero-width v1.0.1/go.mod h1:gGhBV4CZHjqXBYSgaxTCKZj+dXJndhdm1zAtAChtIUI= github.com/ttacon/builder v0.0.0-20170518171403-c099f663e1c2 h1:5u+EJUQiosu3JFX0XS0qTf5FznsMOzTjGqavBGuCbo0= github.com/ttacon/builder v0.0.0-20170518171403-c099f663e1c2/go.mod h1:4kyMkleCiLkgY6z8gK5BkI01ChBtxR0ro3I1ZDcGM3w= github.com/ttacon/libphonenumber v1.1.0 h1:tC6kE4t8UI4OqQVQjW5q8gSWhG2wnY5moEpSEORdYm4=