From 40b9ca48c9031938d640d5effc53be022a1a93ec Mon Sep 17 00:00:00 2001 From: mctaylors Date: Wed, 23 Jul 2025 18:40:16 +0300 Subject: [PATCH 1/2] revert: replace View original with Open in App This reverts commit 1d40f6ae5d4c1bbd8577645ce814d391be6c7832. --- inline_query.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/inline_query.py b/inline_query.py index cde8280..ca83f2d 100644 --- a/inline_query.py +++ b/inline_query.py @@ -38,7 +38,7 @@ async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No async def answer_query( - update: Update, context: ContextTypes.DEFAULT_TYPE, query: int, data + update: Update, context: ContextTypes.DEFAULT_TYPE, query: int, data ) -> None: characters = humanize_tags_from_json(data["tag_string_character"], "no characters") copyrights = humanize_tags_from_json( @@ -53,8 +53,6 @@ async def answer_query( "Show information", url=helpers.create_deep_linked_url(context.bot.username, str(query)), ), - InlineKeyboardButton(f"Open in {config.app.name}", - url=f"{config.app.protocol}://{config.app.hostname}/posts/{query}"), ] ] @@ -92,6 +90,8 @@ async def answer_query( await update.inline_query.answer(results) return + keyboard[0].append(InlineKeyboardButton("View original", url=data["file_url"])) + results = [ InlineQueryResultArticle( id=str(uuid4()), @@ -102,12 +102,15 @@ async def answer_query( " ".join( [ HtmlFormat.code(f"#{query}"), - " ".join( - [ - HtmlFormat.bold(f"{characters} ({copyrights})"), - "drawn by", - HtmlFormat.bold(artists), - ] + HtmlFormat.hyperlink( + " ".join( + [ + HtmlFormat.bold(f"{characters} ({copyrights})"), + "drawn by", + HtmlFormat.bold(artists), + ] + ), + f"{config.app.protocol}://{config.app.hostname}/posts/{query}", ), rating, ] From e2f8653441f95889875ac54915d5ac59431a1ef1 Mon Sep 17 00:00:00 2001 From: mctaylors Date: Wed, 23 Jul 2025 18:56:26 +0300 Subject: [PATCH 2/2] feat: id is now hyperlinked Signed-off-by: mctaylors --- inline_query.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/inline_query.py b/inline_query.py index ca83f2d..51874cf 100644 --- a/inline_query.py +++ b/inline_query.py @@ -38,7 +38,7 @@ async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No async def answer_query( - update: Update, context: ContextTypes.DEFAULT_TYPE, query: int, data + update: Update, context: ContextTypes.DEFAULT_TYPE, query: int, data ) -> None: characters = humanize_tags_from_json(data["tag_string_character"], "no characters") 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"]: results = [ InlineQueryResultArticle( @@ -65,7 +67,7 @@ async def answer_query( input_message_content=InputTextMessageContent( " ".join( [ - HtmlFormat.code(f"#{query}"), + id_string, HtmlFormat.strikethrough( " ".join( [ @@ -101,16 +103,13 @@ async def answer_query( input_message_content=InputTextMessageContent( " ".join( [ - HtmlFormat.code(f"#{query}"), - HtmlFormat.hyperlink( - " ".join( - [ - HtmlFormat.bold(f"{characters} ({copyrights})"), - "drawn by", - HtmlFormat.bold(artists), - ] - ), - f"{config.app.protocol}://{config.app.hostname}/posts/{query}", + id_string, + " ".join( + [ + HtmlFormat.bold(f"{characters} ({copyrights})"), + "drawn by", + HtmlFormat.bold(artists), + ] ), rating, ] @@ -132,7 +131,7 @@ async def invalid_query(update: Update, query: int) -> None: title=f"#{query}", description="Error", 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, ), )