mirror of https://github.com/velour/catbase.git
parent
ce292934cc
commit
83289d65f0
|
@ -71,19 +71,25 @@ func (p *EmojifyMePlugin) Message(message msg.Message) bool {
|
||||||
tokens := strings.Fields(strings.ToLower(message.Body))
|
tokens := strings.Fields(strings.ToLower(message.Body))
|
||||||
for i, token := range tokens {
|
for i, token := range tokens {
|
||||||
if _, ok := p.Emoji[token]; ok {
|
if _, ok := p.Emoji[token]; ok {
|
||||||
|
if token != "a" && token != "it" {
|
||||||
emojied++
|
emojied++
|
||||||
|
}
|
||||||
tokens[i] = ":" + token + ":"
|
tokens[i] = ":" + token + ":"
|
||||||
} else if strings.HasSuffix(token, "s") {
|
} else if strings.HasSuffix(token, "s") {
|
||||||
//Check to see if we can strip the trailing "es" off and get an emoji
|
//Check to see if we can strip the trailing "es" off and get an emoji
|
||||||
temp := strings.TrimSuffix(token, "s")
|
temp := strings.TrimSuffix(token, "s")
|
||||||
if _, ok := p.Emoji[temp]; ok {
|
if _, ok := p.Emoji[temp]; ok {
|
||||||
|
if token != "a" && token != "it" {
|
||||||
emojied++
|
emojied++
|
||||||
|
}
|
||||||
tokens[i] = ":" + temp + ":s"
|
tokens[i] = ":" + temp + ":s"
|
||||||
} else if strings.HasSuffix(token, "es") {
|
} else if strings.HasSuffix(token, "es") {
|
||||||
//Check to see if we can strip the trailing "es" off and get an emoji
|
//Check to see if we can strip the trailing "es" off and get an emoji
|
||||||
temp := strings.TrimSuffix(token, "es")
|
temp := strings.TrimSuffix(token, "es")
|
||||||
if _, ok := p.Emoji[temp]; ok {
|
if _, ok := p.Emoji[temp]; ok {
|
||||||
|
if token != "a" && token != "it" {
|
||||||
emojied++
|
emojied++
|
||||||
|
}
|
||||||
tokens[i] = ":" + temp + ":es"
|
tokens[i] = ":" + temp + ":es"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue