diff options
author | 2021-02-12 15:47:06 -0800 | |
---|---|---|
committer | 2021-02-12 15:47:06 -0800 | |
commit | 059940b5ae3cc2921303579ebf161835fe09076d (patch) | |
tree | caf73eb32224a6d8b2c943713ca1847072479316 | |
parent | Fixed conflicts. (diff) |
Taking only the first line of multiline fields.
-rw-r--r-- | bot/exts/info/pypi.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bot/exts/info/pypi.py b/bot/exts/info/pypi.py index c7d4d321c..cf45b068f 100644 --- a/bot/exts/info/pypi.py +++ b/bot/exts/info/pypi.py @@ -44,11 +44,16 @@ class PyPi(Cog): embed.colour = next(PYPI_COLOURS) for field in FIELDS: + field_data = info[field] + # Field could be completely empty, in some cases can be a string with whitespaces, or None. - if info[field] and not info[field].isspace(): + if field_data and not field_data.isspace(): + if '\n' in field_data and field == "license": + field_data = field_data.split('\n')[0] + embed.add_field( name=field.replace("_", " ").title(), - value=info[field], + value=field_data, inline=False, ) |