From abdab70ce1c07b36bc67f23f8c761b1bf60fc45b Mon Sep 17 00:00:00 2001 From: Andreas Neue Date: Sat, 5 Nov 2016 10:56:40 +0100 Subject: [PATCH] markov.go: Import text after loading state file --- modules/markov.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/markov.go b/modules/markov.go index 5359f59..c930300 100644 --- a/modules/markov.go +++ b/modules/markov.go @@ -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 {