aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Mark <[email protected]>2020-08-18 09:31:26 -0700
committerGravatar GitHub <[email protected]>2020-08-18 09:31:26 -0700
commit73cebf4a5a6553dceb079a91a134cfb979d65ed4 (patch)
tree67361f607978f92e7431b49dfc87392ba5aae935
parentRemove the !ask tag (diff)
parentMerge 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.py3
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 += (