mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[General]: shorten descriptions properly with disabled embeds in urban (#2684)
fix #2683
This commit is contained in:
parent
79e5d2c9d7
commit
9d0ca00f89
@ -307,14 +307,17 @@ class General(commands.Cog):
|
||||
messages = []
|
||||
for ud in data["list"]:
|
||||
ud.setdefault("example", "N/A")
|
||||
description = _("{definition}\n\n**Example:** {example}").format(**ud)
|
||||
if len(description) > 2048:
|
||||
description = "{}...".format(description[:2045])
|
||||
|
||||
message = _(
|
||||
"<{permalink}>\n {word} by {author}\n\n{description}\n\n"
|
||||
"{thumbs_down} Down / {thumbs_up} Up, Powered by Urban Dictionary."
|
||||
).format(word=ud.pop("word").capitalize(), description=description, **ud)
|
||||
).format(word=ud.pop("word").capitalize(), description="{description}", **ud)
|
||||
max_desc_len = 2000 - len(message)
|
||||
|
||||
description = _("{definition}\n\n**Example:** {example}").format(**ud)
|
||||
if len(description) > max_desc_len:
|
||||
description = "{}...".format(description[: max_desc_len - 3])
|
||||
|
||||
message = message.format(description=description)
|
||||
messages.append(message)
|
||||
|
||||
if messages is not None and len(messages) > 0:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user