refactor: merge html_parser.py with extensions.py
All checks were successful
Build / Upload to production (push) Successful in 1m37s
All checks were successful
Build / Upload to production (push) Successful in 1m37s
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
d0357ff7c9
commit
511dc3e9b6
4 changed files with 84 additions and 74 deletions
|
@ -14,7 +14,7 @@ from telegram.ext import ContextTypes
|
|||
|
||||
import html_parser
|
||||
import config
|
||||
from extensions import humanize_tags_from_json, format_rating, get_json
|
||||
from extensions import humanize_tags_from_json, format_rating, get_json, HtmlFormat
|
||||
|
||||
|
||||
async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
|
@ -66,15 +66,15 @@ async def answer_query(
|
|||
input_message_content=InputTextMessageContent(
|
||||
" ".join(
|
||||
[
|
||||
html_parser.code(f"#{query}"),
|
||||
html_parser.strikethrough(
|
||||
HtmlFormat.code(f"#{query}"),
|
||||
HtmlFormat.strikethrough(
|
||||
" ".join(
|
||||
[
|
||||
html_parser.bold(
|
||||
HtmlFormat.bold(
|
||||
f"{characters} ({copyrights})"
|
||||
),
|
||||
"drawn by",
|
||||
html_parser.bold(artists),
|
||||
HtmlFormat.bold(artists),
|
||||
]
|
||||
)
|
||||
),
|
||||
|
@ -102,13 +102,13 @@ async def answer_query(
|
|||
input_message_content=InputTextMessageContent(
|
||||
" ".join(
|
||||
[
|
||||
html_parser.code(f"#{query}"),
|
||||
html_parser.hyperlink(
|
||||
HtmlFormat.code(f"#{query}"),
|
||||
HtmlFormat.hyperlink(
|
||||
" ".join(
|
||||
[
|
||||
html_parser.bold(f"{characters} ({copyrights})"),
|
||||
HtmlFormat.bold(f"{characters} ({copyrights})"),
|
||||
"drawn by",
|
||||
html_parser.bold(artists),
|
||||
HtmlFormat.bold(artists),
|
||||
]
|
||||
),
|
||||
f"{config.app.protocol}://{config.app.hostname}/posts/{query}",
|
||||
|
@ -133,7 +133,7 @@ async def invalid_query(update: Update, query: int) -> None:
|
|||
title=f"#{query}",
|
||||
description="Error",
|
||||
input_message_content=InputTextMessageContent(
|
||||
" ".join([html_parser.code(f"#{query}"), "That record was not found."]),
|
||||
" ".join([HtmlFormat.code(f"#{query}"), "That record was not found."]),
|
||||
parse_mode=ParseMode.HTML,
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue