mirror of https://github.com/velour/catbase.git
update babbler syntax
This commit is contained in:
parent
98298dfb84
commit
8edba10b5d
|
@ -110,14 +110,14 @@ func (p *BabblerPlugin) Message(message msg.Message) bool {
|
|||
saidSomething := false
|
||||
saidWhat := ""
|
||||
|
||||
if numTokens > 2 && tokens[1] == "says" && strings.Contains(lowercase, "syas") {
|
||||
split := strings.Split(lowercase, "syas")
|
||||
if numTokens > 2 && tokens[1] == "says-bridge" && strings.Contains(lowercase, "|") {
|
||||
split := strings.Split(lowercase, "|")
|
||||
start := strings.Fields(split[0])
|
||||
end := strings.Fields(split[1])
|
||||
saidWhat, saidSomething = p.getBabbleWithBookends(start, end)
|
||||
} else if numTokens >= 2 && tokens[1] == "says" {
|
||||
saidWhat, saidSomething = p.getBabble(tokens)
|
||||
} else if numTokens > 2 && tokens[1] == "syas" {
|
||||
} else if numTokens > 2 && tokens[1] == "says-tail" {
|
||||
saidWhat, saidSomething = p.getBabbleWithSuffix(tokens)
|
||||
}else if len(tokens) == 4 && strings.Index(lowercase, "initialize babbler for ") == 0 {
|
||||
saidWhat, saidSomething = p.initializeBabbler(tokens)
|
||||
|
@ -137,7 +137,14 @@ func (p *BabblerPlugin) Message(message msg.Message) bool {
|
|||
}
|
||||
|
||||
func (p *BabblerPlugin) Help(channel string, parts []string) {
|
||||
p.Bot.SendMessage(channel, "initialize babbler for seabass\n\nseabass says")
|
||||
commands := []string{
|
||||
"initialize babbler for seabass",
|
||||
"merge babbler drseabass into seabass",
|
||||
"seabass says ...",
|
||||
"seabass says-tail ...",
|
||||
"seabass says-bridge ... | ...",
|
||||
}
|
||||
p.Bot.SendMessage(channel, strings.Join(commands, "\n\n"))
|
||||
}
|
||||
|
||||
func (p *BabblerPlugin) Event(kind string, message msg.Message) bool {
|
||||
|
|
|
@ -169,8 +169,8 @@ func TestBabblerSuffixSeed(t *testing.T) {
|
|||
res = c.Message(seabass)
|
||||
seabass.Body = "hi there"
|
||||
res = c.Message(seabass)
|
||||
res = c.Message(makeMessage("!seabass syas message one"))
|
||||
res = c.Message(makeMessage("!seabass syas with unique"))
|
||||
res = c.Message(makeMessage("!seabass says-tail message one"))
|
||||
res = c.Message(makeMessage("!seabass says-tail with unique"))
|
||||
assert.Len(t, mb.Messages, 2)
|
||||
assert.True(t, res)
|
||||
assert.Contains(t, mb.Messages[0], "this is message one")
|
||||
|
@ -189,7 +189,7 @@ func TestBabblerBadSuffixSeed(t *testing.T) {
|
|||
res = c.Message(seabass)
|
||||
seabass.Body = "hi there"
|
||||
res = c.Message(seabass)
|
||||
res = c.Message(makeMessage("!seabass syas anything true"))
|
||||
res = c.Message(makeMessage("!seabass says-tail anything true"))
|
||||
assert.Len(t, mb.Messages, 1)
|
||||
assert.True(t, res)
|
||||
assert.Contains(t, mb.Messages[0], "seabass never said 'anything true'")
|
||||
|
@ -203,7 +203,7 @@ func TestBabblerBookendSeed(t *testing.T) {
|
|||
seabass := makeMessage("It's easier to test with unique messages")
|
||||
seabass.User = &user.User{Name: "seabass"}
|
||||
res := c.Message(seabass)
|
||||
res = c.Message(makeMessage("!seabass says It's easier syas unique messages"))
|
||||
res = c.Message(makeMessage("!seabass says-bridge It's easier | unique messages"))
|
||||
assert.Len(t, mb.Messages, 1)
|
||||
assert.True(t, res)
|
||||
assert.Contains(t, mb.Messages[0], "it's easier to test with unique messages")
|
||||
|
@ -217,7 +217,7 @@ func TestBabblerBookendSeedShort(t *testing.T) {
|
|||
seabass := makeMessage("It's easier to test with unique messages")
|
||||
seabass.User = &user.User{Name: "seabass"}
|
||||
res := c.Message(seabass)
|
||||
res = c.Message(makeMessage("!seabass says It's easier to test with syas unique messages"))
|
||||
res = c.Message(makeMessage("!seabass says-bridge It's easier to test with | unique messages"))
|
||||
assert.Len(t, mb.Messages, 1)
|
||||
assert.True(t, res)
|
||||
assert.Contains(t, mb.Messages[0], "it's easier to test with unique messages")
|
||||
|
@ -231,7 +231,7 @@ func TestBabblerBadBookendSeed(t *testing.T) {
|
|||
seabass := makeMessage("It's easier to test with unique messages")
|
||||
seabass.User = &user.User{Name: "seabass"}
|
||||
res := c.Message(seabass)
|
||||
res = c.Message(makeMessage("!seabass says It's easier syas not unique messages"))
|
||||
res = c.Message(makeMessage("!seabass says-bridge It's easier | not unique messages"))
|
||||
assert.Len(t, mb.Messages, 1)
|
||||
assert.True(t, res)
|
||||
assert.Contains(t, mb.Messages[0], "seabass never said 'it's easier ... not unique messages'")
|
||||
|
|
Loading…
Reference in New Issue