diff options
| author | 2021-02-12 00:14:48 -0800 | |
|---|---|---|
| committer | 2021-02-12 00:14:48 -0800 | |
| commit | ed7fde738db677ced25388a53ed9bd539f4490fb (patch) | |
| tree | 979ab6eb1b1bbdb09a6135c315cc2a4519281d65 | |
| parent | Made flake8 very happy. (diff) | |
Empty fields have been accounted for by getting usually non-empty ones.
| -rw-r--r-- | bot/exts/info/pypi.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/bot/exts/info/pypi.py b/bot/exts/info/pypi.py index 544b52b49..7a5d7f4b7 100644 --- a/bot/exts/info/pypi.py +++ b/bot/exts/info/pypi.py @@ -8,7 +8,7 @@ from bot.bot import Bot from bot.constants import Colours, NEGATIVE_REPLIES URL = "https://pypi.org/pypi/{package}/json" -FIELDS = ["author", "requires_python", "description", "license"] +FIELDS = ["author", "requires_python", "summary", "license"] log = logging.getLogger(__name__) @@ -34,14 +34,15 @@ class PyPi(Cog): embed.title = "Python Package Index" embed.colour = Colours.soft_green - embed.description = f"[{info['name']} v{info['version']}]({info['download_url']})\n" + embed.description = f"[{info['name']} v{info['version']}]({info['package_url']})\n" for field in FIELDS: - embed.add_field( - name=field.replace("_", " ").title(), - value=info[field], - inline=False, - ) + if field_value := info[field]: + embed.add_field( + name=field.replace("_", " ").title(), + value=field_value, + inline=False, + ) else: embed.description = "There was an error when fetching your PyPi package." |