Skip to content

Commit

Permalink
feat(nhentai): show number of pages in sauce
Browse files Browse the repository at this point in the history
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 <ksdfg123@gmail.com>
  • Loading branch information
ksdfg committed May 15, 2022
1 parent 0bbaf06 commit a6309a8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion telebot/modules/nhentai.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def sauce(update: Update, context: CallbackContext) -> None:
"Code": f'<a href="https://telegra.ph/{article_path}">{code}</a>',
"Title": f'<a href="{doujin.url}">{doujin.title(Format.Pretty)}</a>',
"Tags": _generate_anchor_tags(doujin.tag),
"Pages": f'<a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">{len(doujin.pages)}</a>',
"Characters": _generate_anchor_tags(doujin.character),
"Parodies": _generate_anchor_tags(doujin.parody),
"Artists": _generate_anchor_tags(doujin.artist),
Expand All @@ -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))
Expand Down

0 comments on commit a6309a8

Please sign in to comment.