Merge pull request #135 from velour/emojifyreact

emojify: woops
This commit is contained in:
Chris Sexton 2019-01-21 18:34:53 -05:00 committed by GitHub
commit 52bc70cf8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -71,6 +71,7 @@ func (p *EmojifyMePlugin) Message(message msg.Message) bool {
for k, v := range p.Emoji { for k, v := range p.Emoji {
k = strings.Replace(k, "_", " ", -1) k = strings.Replace(k, "_", " ", -1)
candidates := []string{ candidates := []string{
k,
k + "es", k + "es",
k + "s", k + "s",
} }
@ -79,8 +80,8 @@ func (p *EmojifyMePlugin) Message(message msg.Message) bool {
strings.HasPrefix(msg, c) || strings.HasPrefix(msg, c) ||
strings.HasSuffix(msg, c) { strings.HasSuffix(msg, c) {
emojys = append(emojys, v) emojys = append(emojys, v)
if !stringsContain(inertTokens, k) || len(k) <= 2 { if !stringsContain(inertTokens, k) || len(v) < 2 {
emojied++ emojied += 1
} }
} }
} }