mirror of https://github.com/velour/catbase.git
Merge pull request #45 from velour/shhhh_babbler
Quiet down the babbler misses
This commit is contained in:
commit
3ff10ed38b
|
@ -87,9 +87,7 @@ func (p *BabblerPlugin) Message(message msg.Message) bool {
|
||||||
} else {
|
} else {
|
||||||
saying = p.babbleSeed(tokens[0], tokens[2:])
|
saying = p.babbleSeed(tokens[0], tokens[2:])
|
||||||
}
|
}
|
||||||
if saying == "" {
|
if saying != "" {
|
||||||
p.Bot.SendMessage(message.Channel, "Ze ain't said nothin'")
|
|
||||||
} else {
|
|
||||||
p.Bot.SendMessage(message.Channel, saying)
|
p.Bot.SendMessage(message.Channel, saying)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
@ -315,7 +313,7 @@ func (p *BabblerPlugin) babbleSeed(who string, seed []string) string {
|
||||||
return strings.TrimSpace(strings.Join(words, " "))
|
return strings.TrimSpace(strings.Join(words, " "))
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("could not find babbler: %s", who)
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (into *babbler) merge(other *babbler, intoName, otherName string) {
|
func (into *babbler) merge(other *babbler, intoName, otherName string) {
|
||||||
|
|
|
@ -30,10 +30,9 @@ func TestBabblerNoBabbler(t *testing.T) {
|
||||||
c := New(mb)
|
c := New(mb)
|
||||||
c.config.Babbler.DefaultUsers = []string{"seabass"}
|
c.config.Babbler.DefaultUsers = []string{"seabass"}
|
||||||
assert.NotNil(t, c)
|
assert.NotNil(t, c)
|
||||||
res := c.Message(makeMessage("!seabass2 says"))
|
c.Message(makeMessage("!seabass2 says"))
|
||||||
assert.Len(t, mb.Messages, 1)
|
res := assert.Len(t, mb.Messages, 0)
|
||||||
assert.True(t, res)
|
assert.True(t, res)
|
||||||
assert.Contains(t, mb.Messages[0], "could not find babbler: seabass2")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBabblerNothingSaid(t *testing.T) {
|
func TestBabblerNothingSaid(t *testing.T) {
|
||||||
|
@ -42,9 +41,8 @@ func TestBabblerNothingSaid(t *testing.T) {
|
||||||
c.config.Babbler.DefaultUsers = []string{"seabass"}
|
c.config.Babbler.DefaultUsers = []string{"seabass"}
|
||||||
assert.NotNil(t, c)
|
assert.NotNil(t, c)
|
||||||
res := c.Message(makeMessage("!seabass says"))
|
res := c.Message(makeMessage("!seabass says"))
|
||||||
assert.Len(t, mb.Messages, 1)
|
assert.Len(t, mb.Messages, 0)
|
||||||
assert.True(t, res)
|
assert.True(t, res)
|
||||||
assert.Contains(t, mb.Messages[0], "Ze ain't said nothin")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBabbler(t *testing.T) {
|
func TestBabbler(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue