diff options
| author | 2020-08-18 09:31:26 -0700 | |
|---|---|---|
| committer | 2020-08-18 09:31:26 -0700 | |
| commit | 73cebf4a5a6553dceb079a91a134cfb979d65ed4 (patch) | |
| tree | 67361f607978f92e7431b49dfc87392ba5aae935 | |
| parent | Remove the !ask tag (diff) | |
| parent | Merge branch 'master' into bug/frontend/1030/reddit-title-escape (diff) | |
Merge pull request #1108 from python-discord/bug/frontend/1030/reddit-title-escape
Escape Markdown in reddit post titles
| -rw-r--r-- | bot/cogs/reddit.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bot/cogs/reddit.py b/bot/cogs/reddit.py index d853ab2ea..5d9e2c20b 100644 --- a/bot/cogs/reddit.py +++ b/bot/cogs/reddit.py @@ -10,6 +10,7 @@ from aiohttp import BasicAuth, ClientError from discord import Colour, Embed, TextChannel from discord.ext.commands import Cog, Context, group from discord.ext.tasks import loop +from discord.utils import escape_markdown from bot.bot import Bot from bot.constants import Channels, ERROR_REPLIES, Emojis, Reddit as RedditConfig, STAFF_ROLES, Webhooks @@ -187,6 +188,8 @@ class Reddit(Cog): author = data["author"] title = textwrap.shorten(data["title"], width=64, placeholder="...") + # Normal brackets interfere with Markdown. + title = escape_markdown(title).replace("[", "⦋").replace("]", "⦌") link = self.URL + data["permalink"] embed.description += ( |