From 9e21b15781c7cd589d3c41d1eea60201fb89deb5 Mon Sep 17 00:00:00 2001 From: mihalin Date: Fri, 11 Feb 2022 04:06:28 +0300 Subject: [PATCH] fix phrases --- server/inlines.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/inlines.py b/server/inlines.py index 452c179..c6a0417 100644 --- a/server/inlines.py +++ b/server/inlines.py @@ -7,8 +7,8 @@ import typing as ty @cached(ttl=1) -async def get_phrases(bot: int) -> ty.List: - objects = await DefaultAnswer.filter(bot_id=bot) +async def get_phrases(bot: Bot) -> ty.List: + objects = await bot.answers return [obj.text for obj in objects] @@ -18,7 +18,7 @@ async def inline_handler(inline_query: InlineQuery, bot: Bot): # if bot.super_chat_id() != user_id: # return await inline_query.answer([], cache_time=1) # forbidden - all_phrases = await get_phrases(bot.id) + all_phrases = await get_phrases(bot) print(f"All phrases {all_phrases}") phrases = [phrase for phrase in all_phrases if inline_query.query.lower() in phrase.lower()] print(f"phrases {phrases}")