From 6ea2a403be98448f5da6c46bc55c883983272e66 Mon Sep 17 00:00:00 2001 From: MeatyChunks <6160351+MeatyChunks@users.noreply.github.com> Date: Sun, 11 Oct 2020 16:14:21 +0100 Subject: [PATCH] [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 --- redbot/cogs/general/general.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redbot/cogs/general/general.py b/redbot/cogs/general/general.py index f7c443e9a..feb14a59e 100644 --- a/redbot/cogs/general/general.py +++ b/redbot/cogs/general/general.py @@ -505,9 +505,12 @@ class General(commands.Cog): embeds = [] for ud in data["list"]: embed = discord.Embed() - embed.title = _("{word} by {author}").format( + title = _("{word} by {author}").format( word=ud["word"].capitalize(), author=ud["author"] ) + if len(title) > 256: + title = "{}...".format(title[:253]) + embed.title = title embed.url = ud["permalink"] description = _("{definition}\n\n**Example:** {example}").format(**ud)