refactor: pt. 2: my head hurts

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2025-06-08 08:12:29 +03:00
parent 6ea4f2c3ed
commit 84fbbeba4c
Signed by: mctaylors
GPG key ID: 4EEF4F949A266EE2

View file

@ -15,20 +15,28 @@ from extensions import get_json, format_rating, format_status, humanize_filesize
async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
await update.message.reply_text(
f"hello, i'm {html_parser.bold(context.bot.first_name)}, an inline image grabber.\n\n"
f"to get help, use /help",
"\n".join(
[
f"hello, i'm {html_parser.bold(context.bot.first_name)}, an inline image grabber.\n",
"to get help, use /help",
]
),
parse_mode=ParseMode.HTML,
)
async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
await update.message.reply_text(
f"{html_parser.bold(f"how to use {context.bot.first_name}")}\n\n"
f"1. open your message box and type:\n"
f"{html_parser.code(f"@{context.bot.username} &lt;post ID&gt;")}\n"
f"2. click on the box that has popped up\n"
f"3. ???\n"
f"4. done!",
"\n".join(
[
html_parser.bold(f"how to use {context.bot.first_name}\n"),
"1. open your message box and type:",
html_parser.code(f"@{context.bot.username} &lt;post ID&gt;"),
"2. click on the box that has popped up",
"3. ???",
"4. done!",
]
),
parse_mode=ParseMode.HTML,
)
@ -40,11 +48,15 @@ async def about_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> N
reply_markup = InlineKeyboardMarkup(keyboard)
await update.message.reply_text(
f"{html_parser.bold(f"about {context.bot.first_name}")}\n"
f"{context.bot.first_name} is an inline image grabber written in python that grabs images from Danbooru "
f"(or other similar services).\n\n"
f"{html_parser.bold("currently configured instance:")}\n"
f"{html_parser.italic(app.name)} ({app.hostname})",
"\n".join(
[
html_parser.bold(f"about {context.bot.first_name}"),
f"{context.bot.first_name} is an inline image grabber written in python that grabs images from "
"Danbooru (or other similar services).\n",
html_parser.bold("currently configured instance:"),
f"{html_parser.italic(app.name)} ({app.hostname})",
]
),
parse_mode=ParseMode.HTML,
reply_markup=reply_markup,
)
@ -55,13 +67,13 @@ async def info_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
post_id = context.args[0]
message = await context.bot.send_message(
update.effective_chat.id,
f"{html_parser.bold("Information")}\n" f"Fetching...",
"\n".join([html_parser.bold("Information"), "Fetching..."]),
parse_mode=ParseMode.HTML,
)
post_data = get_json(f"posts/{post_id}")
if post_data is None:
await context.bot.edit_message_text(
f"{html_parser.bold("Error")}: That record was not found.",
" ".join([html_parser.bold("Error:"), "That record was not found."]),
update.effective_chat.id,
message.message_id,
parse_mode=ParseMode.HTML,