From e65afb915a452ce9b0304d9bde01741cf02e3d2f Mon Sep 17 00:00:00 2001 From: skkiesel Date: Wed, 30 Aug 2017 09:24:16 -0400 Subject: [PATCH] look for common plural suffixes for more emoji hits --- plugins/emojifyme/emojifyme.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/emojifyme/emojifyme.go b/plugins/emojifyme/emojifyme.go index a88911f..65b892f 100644 --- a/plugins/emojifyme/emojifyme.go +++ b/plugins/emojifyme/emojifyme.go @@ -73,6 +73,20 @@ func (p *EmojifyMePlugin) Message(message msg.Message) bool { if _, ok := p.Emoji[token]; ok { emojied++ tokens[i] = ":" + token + ":" + } else if strings.HasSuffix(token, "s") { + //Check to see if we can strip the trailing "es" off and get an emoji + temp := strings.TrimSuffix(token, "s") + if _, ok := p.Emoji[temp]; ok { + emojied++ + tokens[i] = ":" + temp + ":s" + } else if strings.HasSuffix(token, "es") { + //Check to see if we can strip the trailing "es" off and get an emoji + temp := strings.TrimSuffix(token, "es") + if _, ok := p.Emoji[temp]; ok { + emojied++ + tokens[i] = ":" + temp + ":es" + } + } } } if emojied > 0 && rand.Float64() <= p.Bot.Config().Emojify.Chance*emojied {