markov.go: Import text after loading state file

This commit is contained in:
Andreas Neue 2016-11-05 10:56:40 +01:00
parent 5f9238a433
commit abdab70ce1
1 changed files with 4 additions and 7 deletions

View File

@ -57,8 +57,10 @@ func markovHandleMessage(m *irc.Message) {
func markovRun() {
prefixLen, _ := strconv.Atoi(ModParams["markov-prefix-len"])
markovChain = markovNewChain(prefixLen)
//if *importFile != "" {
// StartImport(*importFile)
err := markovChain.Load(ModParams["markov-state-file"])
if err != nil {
xlog.Error(err.Error())
}
filepath := ModParams["markov-import-file"]
if filepath != "-" {
file, _ := os.Open(filepath)
@ -70,11 +72,6 @@ func markovRun() {
markovChain.Write(text)
}
}
} else {
err := markovChain.Load(ModParams["markov-state-file"])
if err != nil {
xlog.Error(err.Error())
}
}
go func() {
for {