Skip to content

Commit 6ea2a40

Browse files
authored
[General] Fix error on long titles in [p]urban (Cog-Creators#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
1 parent 4f2763c commit 6ea2a40

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

redbot/cogs/general/general.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,12 @@ async def urban(self, ctx, *, word):
505505
embeds = []
506506
for ud in data["list"]:
507507
embed = discord.Embed()
508-
embed.title = _("{word} by {author}").format(
508+
title = _("{word} by {author}").format(
509509
word=ud["word"].capitalize(), author=ud["author"]
510510
)
511+
if len(title) > 256:
512+
title = "{}...".format(title[:253])
513+
embed.title = title
511514
embed.url = ud["permalink"]
512515

513516
description = _("{definition}\n\n**Example:** {example}").format(**ud)

0 commit comments

Comments
 (0)