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}")