first: disallow empty messages

This commit is contained in:
Chris Sexton 2020-10-19 21:28:13 -04:00 committed by Chris Sexton
parent 11224e0a2f
commit bd2e28f72a
1 changed files with 3 additions and 0 deletions

View File

@ -175,6 +175,9 @@ func (p *FirstPlugin) message(c bot.Connector, kind bot.Kind, message msg.Messag
} }
func (p *FirstPlugin) allowed(message msg.Message) bool { func (p *FirstPlugin) allowed(message msg.Message) bool {
if message.Body == "" {
return false
}
for _, m := range p.Bot.Config().GetArray("Bad.Msgs", []string{}) { for _, m := range p.Bot.Config().GetArray("Bad.Msgs", []string{}) {
match, err := regexp.MatchString(m, strings.ToLower(message.Body)) match, err := regexp.MatchString(m, strings.ToLower(message.Body))
if err != nil { if err != nil {