Merge pull request #137 from velour/emojyless

emojify: make sure there are spaces around beginning/ending emojy
This commit is contained in:
Chris Sexton 2019-01-22 10:46:43 -05:00 committed by GitHub
commit ca8334c60c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -77,8 +77,8 @@ func (p *EmojifyMePlugin) Message(message msg.Message) bool {
} }
for _, c := range candidates { for _, c := range candidates {
if strings.Contains(msg, " "+c+" ") || if strings.Contains(msg, " "+c+" ") ||
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(v) < 2 { if !stringsContain(inertTokens, k) || len(v) < 2 {
emojied += 1 emojied += 1