[General] Fix error on long titles in [p]urban (#4474)

There's a few titles that are greater than 256 which causes a console error. The example I saw was scrolling through the pages of `[p]urban Jackin' Off` which leads to http://synonyms-chokin-the-chicken-spanking-the-monkey-flogging-the-do.urbanup.com/3169366
This commit is contained in:
MeatyChunks 2020-10-11 16:14:21 +01:00 committed by GitHub
parent 4f2763c26c
commit 6ea2a403be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -505,9 +505,12 @@ class General(commands.Cog):
embeds = [] embeds = []
for ud in data["list"]: for ud in data["list"]:
embed = discord.Embed() embed = discord.Embed()
embed.title = _("{word} by {author}").format( title = _("{word} by {author}").format(
word=ud["word"].capitalize(), author=ud["author"] word=ud["word"].capitalize(), author=ud["author"]
) )
if len(title) > 256:
title = "{}...".format(title[:253])
embed.title = title
embed.url = ud["permalink"] embed.url = ud["permalink"]
description = _("{definition}\n\n**Example:** {example}").format(**ud) description = _("{definition}\n\n**Example:** {example}").format(**ud)