maybe no self.markov
This commit is contained in:
parent
dd5224dd0d
commit
d60a49c275
1 changed files with 5 additions and 3 deletions
|
@ -208,16 +208,18 @@ class DelojzaBot:
|
|||
self.handle([url], update.message, self.download_raw, filename=filename)
|
||||
|
||||
def handle_text(self, _, update):
|
||||
self.markov.add_to_corpus(update.message.text)
|
||||
if self.markov:
|
||||
self.markov.add_to_corpus(update.message.text)
|
||||
|
||||
def tg_start(self, _, update):
|
||||
update.message.reply_text(self.markov.make_sentence())
|
||||
update.message.reply_text(self.markov.make_sentence() if self.markov else "HELLO")
|
||||
|
||||
def tg_error(self, bot, update, error):
|
||||
self.logger.error(error)
|
||||
if "Timed out" in str(error):
|
||||
if update is not None:
|
||||
update.message.reply_text(self.markov.make_sentence(tries=100) or "Mmmm, I like it...")
|
||||
default = "Mmmm, I like it..."
|
||||
update.message.reply_text((self.markov.make_sentence(tries=100) if self.markov else default) or default)
|
||||
self.handle_rest(bot, update)
|
||||
else:
|
||||
if update is not None:
|
||||
|
|
Loading…
Reference in a new issue