From 26b26c69c7d3b8c99fcf0c19f7e3a887df5fc5e7 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Wed, 27 Nov 2019 23:13:59 +0300 Subject: [PATCH] fix markovify --- bots/modules/cyberlina.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bots/modules/cyberlina.py b/bots/modules/cyberlina.py index cccbc73..b03ace4 100644 --- a/bots/modules/cyberlina.py +++ b/bots/modules/cyberlina.py @@ -40,10 +40,6 @@ class CyberLinaBotModuleConfig(TelegramBotModuleConfig): '_mtg_data': JSONEditor(), } - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.mtg = markovify.Text.from_dict(self._mtg_data) - def message_handler(self, update: Update, ctx: CallbackContext): if not update.effective_chat or not update.effective_user: return @@ -91,6 +87,7 @@ class CyberLinaBotModuleConfig(TelegramBotModuleConfig): def inline_query_handler(self, update: Update, ctx: CallbackContext): if not self.inline_reactions: return + mtg = markovify.Text.from_dict(self._mtg_data) seed(os.urandom(128)) results = [ InlineQueryResultArticle( @@ -101,7 +98,7 @@ class CyberLinaBotModuleConfig(TelegramBotModuleConfig): InlineQueryResultArticle( id=uuid4(), title='ФлаБеПроЛейка', - input_message_content=InputTextMessageContent(choice(self.mtg.generate_text())) + input_message_content=InputTextMessageContent(mtg.make_sentence()) ), ] update.inline_query.answer(results, cache_time=0)