markov.go: undo multiple line responses
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
c85e1adcc4
commit
59bf94f173
|
@ -49,11 +49,8 @@ func markovHandleMessage(m *Message) {
|
||||||
responseText := markovChain.Generate(*markovAnswerLen, text)
|
responseText := markovChain.Generate(*markovAnswerLen, text)
|
||||||
if responseText != "" {
|
if responseText != "" {
|
||||||
go func() {
|
go func() {
|
||||||
responses := strings.Split(responseText, "\n")
|
|
||||||
for _, s := range responses {
|
|
||||||
time.Sleep(time.Duration(rand.Intn(8)+2) * time.Second)
|
time.Sleep(time.Duration(rand.Intn(8)+2) * time.Second)
|
||||||
SayCh <- m.Channel + "\n" + s
|
SayCh <- m.Channel + "\n" + responseText
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,11 +228,7 @@ func (c *MarkovChain) Generate(n int, in string) string {
|
||||||
return start + " ... pfrrrz"
|
return start + " ... pfrrrz"
|
||||||
} else {
|
} else {
|
||||||
xlog.Debug("Found words: [%s]", strings.Join(words, " "))
|
xlog.Debug("Found words: [%s]", strings.Join(words, " "))
|
||||||
answer := start + " " + strings.Join(words, " ")
|
return start + " " + strings.Join(words, " ")
|
||||||
if rand.Intn(100) < 25 {
|
|
||||||
answer = answer + "\n" + c.Generate(n, answer)
|
|
||||||
}
|
|
||||||
return answer
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue