From a6309a8794a678fd15a8edbe4f82f1b31221e379 Mon Sep 17 00:00:00 2001 From: ksdfg Date: Sun, 15 May 2022 22:23:11 +0530 Subject: [PATCH] feat(nhentai): show number of pages in sauce Also remove any fields that do not have a value, to make sure we're not just padding the message with empty lines Signed-off-by: ksdfg --- telebot/modules/nhentai.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/telebot/modules/nhentai.py b/telebot/modules/nhentai.py index cae457f..c13874c 100644 --- a/telebot/modules/nhentai.py +++ b/telebot/modules/nhentai.py @@ -66,6 +66,7 @@ def sauce(update: Update, context: CallbackContext) -> None: "Code": f'{code}', "Title": f'{doujin.title(Format.Pretty)}', "Tags": _generate_anchor_tags(doujin.tag), + "Pages": f'{len(doujin.pages)}', "Characters": _generate_anchor_tags(doujin.character), "Parodies": _generate_anchor_tags(doujin.parody), "Artists": _generate_anchor_tags(doujin.artist), @@ -75,7 +76,7 @@ def sauce(update: Update, context: CallbackContext) -> None: } # add details to the reply to be sent to the user - text_blob = "\n\n".join(f"{key}\n{value}" for key, value in data.items()) + text_blob = "\n\n".join(f"{key}\n{value}" for key, value in data.items() if value) # button with nhentai link markup = InlineKeyboardMarkup.from_button(InlineKeyboardButton(text="Link to nHentai", url=doujin.url))