mirror of
https://github.com/civsocit/olgram.git
synced 2023-07-22 01:29:12 +03:00
fix phrases
This commit is contained in:
parent
bd239f6b2f
commit
9e21b15781
@ -7,8 +7,8 @@ import typing as ty
|
|||||||
|
|
||||||
|
|
||||||
@cached(ttl=1)
|
@cached(ttl=1)
|
||||||
async def get_phrases(bot: int) -> ty.List:
|
async def get_phrases(bot: Bot) -> ty.List:
|
||||||
objects = await DefaultAnswer.filter(bot_id=bot)
|
objects = await bot.answers
|
||||||
return [obj.text for obj in objects]
|
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:
|
# if bot.super_chat_id() != user_id:
|
||||||
# return await inline_query.answer([], cache_time=1) # forbidden
|
# 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}")
|
print(f"All phrases {all_phrases}")
|
||||||
phrases = [phrase for phrase in all_phrases if inline_query.query.lower() in phrase.lower()]
|
phrases = [phrase for phrase in all_phrases if inline_query.query.lower() in phrase.lower()]
|
||||||
print(f"phrases {phrases}")
|
print(f"phrases {phrases}")
|
||||||
|
Loading…
Reference in New Issue
Block a user