markov.go: Import text after loading state file
This commit is contained in:
parent
5f9238a433
commit
abdab70ce1
|
@ -57,8 +57,10 @@ func markovHandleMessage(m *irc.Message) {
|
||||||
func markovRun() {
|
func markovRun() {
|
||||||
prefixLen, _ := strconv.Atoi(ModParams["markov-prefix-len"])
|
prefixLen, _ := strconv.Atoi(ModParams["markov-prefix-len"])
|
||||||
markovChain = markovNewChain(prefixLen)
|
markovChain = markovNewChain(prefixLen)
|
||||||
//if *importFile != "" {
|
err := markovChain.Load(ModParams["markov-state-file"])
|
||||||
// StartImport(*importFile)
|
if err != nil {
|
||||||
|
xlog.Error(err.Error())
|
||||||
|
}
|
||||||
filepath := ModParams["markov-import-file"]
|
filepath := ModParams["markov-import-file"]
|
||||||
if filepath != "-" {
|
if filepath != "-" {
|
||||||
file, _ := os.Open(filepath)
|
file, _ := os.Open(filepath)
|
||||||
|
@ -70,11 +72,6 @@ func markovRun() {
|
||||||
markovChain.Write(text)
|
markovChain.Write(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
err := markovChain.Load(ModParams["markov-state-file"])
|
|
||||||
if err != nil {
|
|
||||||
xlog.Error(err.Error())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
|
Loading…
Reference in New Issue