2025-01-08 22:58:12 +03:00
|
|
|
from aiogram import types
|
|
|
|
|
2025-01-09 00:03:19 +03:00
|
|
|
import re
|
2025-01-08 22:58:12 +03:00
|
|
|
|
|
|
|
async def reply(result_id: str, args: list, query: types.InlineQuery) -> None:
|
|
|
|
if not args:
|
|
|
|
return
|
|
|
|
|
|
|
|
articles = []
|
|
|
|
|
|
|
|
for idx, arg in enumerate(args):
|
|
|
|
title = arg[0]
|
|
|
|
description = arg[1] if arg[1] else None
|
|
|
|
img = arg[2] if arg[2] else None
|
|
|
|
|
|
|
|
|
|
|
|
article = types.InlineQueryResultArticle(
|
|
|
|
id=f"{result_id}_{idx}",
|
2025-01-09 00:03:19 +03:00
|
|
|
title=re.sub(r'\bГрафик\b|\[([^\]]+)\]\([^)]+\)', '', title, flags=re.IGNORECASE),
|
2025-01-08 22:58:12 +03:00
|
|
|
thumbnail_url=img,
|
|
|
|
description=description,
|
|
|
|
input_message_content=types.InputTextMessageContent(
|
|
|
|
message_text=title,
|
|
|
|
parse_mode='markdown'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
articles.append(article)
|
|
|
|
|
|
|
|
await query.answer(
|
|
|
|
results=articles,
|
|
|
|
parse_mode='markdown',
|
|
|
|
cache_time=0,
|
|
|
|
is_personal=True
|
|
|
|
)
|