mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[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:
parent
4f2763c26c
commit
6ea2a403be
@ -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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user