mirror of https://github.com/velour/catbase.git
merge a spaced out count into one in the case of an emojy or anything with a space really
This commit is contained in:
parent
96a887917a
commit
b1a4fd2050
|
@ -358,7 +358,10 @@ func (p *CounterPlugin) Message(message msg.Message) bool {
|
|||
itemName))
|
||||
|
||||
return true
|
||||
} else if len(parts) == 1 {
|
||||
} else if len(parts) <= 2 {
|
||||
if (len(parts) == 2) && (parts[1] == "++" || parts[1] == "--") {
|
||||
parts = []string{parts[0] + parts[1]}
|
||||
}
|
||||
// Need to have at least 3 characters to ++ or --
|
||||
if len(parts[0]) < 3 {
|
||||
return false
|
||||
|
|
|
@ -99,6 +99,15 @@ func TestCounterOne(t *testing.T) {
|
|||
assert.Equal(t, mb.Messages[0], "tester has 1 test.")
|
||||
}
|
||||
|
||||
func TestCounterOneWithSpace(t *testing.T) {
|
||||
mb := bot.NewMockBot()
|
||||
c := New(mb)
|
||||
assert.NotNil(t, c)
|
||||
c.Message(makeMessage(":test: ++"))
|
||||
assert.Len(t, mb.Messages, 1)
|
||||
assert.Equal(t, mb.Messages[0], "tester has 1 :test:.")
|
||||
}
|
||||
|
||||
func TestCounterFour(t *testing.T) {
|
||||
mb := bot.NewMockBot()
|
||||
c := New(mb)
|
||||
|
|
Loading…
Reference in New Issue