fix phrases

This commit is contained in:
mihalin 2022-02-11 04:06:28 +03:00
parent bd239f6b2f
commit 9e21b15781

View File

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