feat: id is now hyperlinked
All checks were successful
Build / Upload to production (push) Successful in 1m19s

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
mctaylors 2025-07-23 18:56:26 +03:00
parent 40b9ca48c9
commit e2f8653441
Signed by: mctaylors
GPG key ID: 9CF54A3ADF697D43

View file

@ -38,7 +38,7 @@ async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
async def answer_query( async def answer_query(
update: Update, context: ContextTypes.DEFAULT_TYPE, query: int, data update: Update, context: ContextTypes.DEFAULT_TYPE, query: int, data
) -> None: ) -> None:
characters = humanize_tags_from_json(data["tag_string_character"], "no characters") characters = humanize_tags_from_json(data["tag_string_character"], "no characters")
copyrights = humanize_tags_from_json( copyrights = humanize_tags_from_json(
@ -56,6 +56,8 @@ async def answer_query(
] ]
] ]
id_string = HtmlFormat.hyperlink(f"#{query}", f"{config.app.protocol}://{config.app.hostname}/posts/{query}")
if data["is_banned"]: if data["is_banned"]:
results = [ results = [
InlineQueryResultArticle( InlineQueryResultArticle(
@ -65,7 +67,7 @@ async def answer_query(
input_message_content=InputTextMessageContent( input_message_content=InputTextMessageContent(
" ".join( " ".join(
[ [
HtmlFormat.code(f"#{query}"), id_string,
HtmlFormat.strikethrough( HtmlFormat.strikethrough(
" ".join( " ".join(
[ [
@ -101,16 +103,13 @@ async def answer_query(
input_message_content=InputTextMessageContent( input_message_content=InputTextMessageContent(
" ".join( " ".join(
[ [
HtmlFormat.code(f"#{query}"), id_string,
HtmlFormat.hyperlink( " ".join(
" ".join( [
[ HtmlFormat.bold(f"{characters} ({copyrights})"),
HtmlFormat.bold(f"{characters} ({copyrights})"), "drawn by",
"drawn by", HtmlFormat.bold(artists),
HtmlFormat.bold(artists), ]
]
),
f"{config.app.protocol}://{config.app.hostname}/posts/{query}",
), ),
rating, rating,
] ]
@ -132,7 +131,7 @@ async def invalid_query(update: Update, query: int) -> None:
title=f"#{query}", title=f"#{query}",
description="Error", description="Error",
input_message_content=InputTextMessageContent( input_message_content=InputTextMessageContent(
" ".join([HtmlFormat.code(f"#{query}"), "That record was not found."]), " ".join([HtmlFormat.strikethrough(f"#{query}"), "That record was not found."]),
parse_mode=ParseMode.HTML, parse_mode=ParseMode.HTML,
), ),
) )