From 83289d65f0394c7f8f8c34b2709dab1de31e984b Mon Sep 17 00:00:00 2001 From: Steve McCoy Date: Mon, 27 Nov 2017 22:07:59 -0500 Subject: [PATCH] Don't count "a" and "it" toward the emojification score Fixes #95. --- plugins/emojifyme/emojifyme.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/emojifyme/emojifyme.go b/plugins/emojifyme/emojifyme.go index e8a6119..e71aede 100644 --- a/plugins/emojifyme/emojifyme.go +++ b/plugins/emojifyme/emojifyme.go @@ -71,19 +71,25 @@ func (p *EmojifyMePlugin) Message(message msg.Message) bool { tokens := strings.Fields(strings.ToLower(message.Body)) for i, token := range tokens { if _, ok := p.Emoji[token]; ok { - emojied++ + if token != "a" && token != "it" { + 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++ + if token != "a" && token != "it" { + 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++ + if token != "a" && token != "it" { + emojied++ + } tokens[i] = ":" + temp + ":es" } }