Cap the amount of featured shows to be 5

This commit is contained in:
blank X 2021-03-29 10:18:10 +07:00
parent 3db00d9be5
commit 16a4b6850b
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 4 additions and 2 deletions

View File

@ -171,7 +171,7 @@ async def generate_character(anilist):
else: else:
text += '\n' text += '\n'
to_add = [] to_add = []
for i in media: for i in media[:5]:
atext = f'<a href="{i["siteUrl"]}">{i["title"]["romaji"]}</a>' atext = f'<a href="{i["siteUrl"]}">{i["title"]["romaji"]}</a>'
if i['title']['english']: if i['title']['english']:
atext += f' ({i["title"]["english"]})' atext += f' ({i["title"]["english"]})'
@ -181,8 +181,10 @@ async def generate_character(anilist):
type = 'Light Novel' type = 'Light Novel'
else: else:
type = i['type'].capitalize() type = i['type'].capitalize()
to_add.append(atext + f' [{type}]') to_add.append(f'{atext} [{type}]')
text += '\n'.join(to_add) text += '\n'.join(to_add)
if len(media) > 5:
text += f'\n(and {len(media) - 5} other{"" if len(media) == 6 else "s"})'
if description: if description:
text += '\n' text += '\n'
parser = pyrogram_html.HTML(None) parser = pyrogram_html.HTML(None)