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))
|
itemName))
|
||||||
|
|
||||||
return true
|
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 --
|
// Need to have at least 3 characters to ++ or --
|
||||||
if len(parts[0]) < 3 {
|
if len(parts[0]) < 3 {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -99,6 +99,15 @@ func TestCounterOne(t *testing.T) {
|
||||||
assert.Equal(t, mb.Messages[0], "tester has 1 test.")
|
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) {
|
func TestCounterFour(t *testing.T) {
|
||||||
mb := bot.NewMockBot()
|
mb := bot.NewMockBot()
|
||||||
c := New(mb)
|
c := New(mb)
|
||||||
|
|
Loading…
Reference in New Issue