diff options
| author | 2020-08-15 12:49:26 -0700 | |
|---|---|---|
| committer | 2020-08-15 12:50:54 -0700 | |
| commit | 056936eafc927e8770acdc6f70bf2971cca4f4d2 (patch) | |
| tree | 2731c64d8a38cc1e0c5ccf057725ad4284d5307f | |
| parent | Merge pull request #1102 from AtieP/patch-1 (diff) | |
Escape Markdown in reddit post titles
Use a Unicode look-alike character to replace square brackets, since
they'd otherwise interfere with the Markdown.
Fixes #1030
Diffstat (limited to '')
| -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 += ( | 
