diff options
| -rw-r--r-- | bot/exts/info/reddit.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/exts/info/reddit.py b/bot/exts/info/reddit.py index 6790be762..e1f0c5f9f 100644 --- a/bot/exts/info/reddit.py +++ b/bot/exts/info/reddit.py @@ -4,6 +4,7 @@ import random import textwrap from collections import namedtuple from datetime import datetime, timedelta +from html import unescape from typing import List from aiohttp import BasicAuth, ClientError @@ -179,8 +180,7 @@ class Reddit(Cog): for post in posts: data = post["data"] - text = data["selftext"] - if text: + if text := unescape(data["selftext"]): text = textwrap.shorten(text, width=128, placeholder="...") text += "\n" # Add newline to separate embed info @@ -188,7 +188,7 @@ class Reddit(Cog): comments = data["num_comments"] author = data["author"] - title = textwrap.shorten(data["title"], width=64, placeholder="...") + title = textwrap.shorten(unescape(data["title"]), width=64, placeholder="...") # Normal brackets interfere with Markdown. title = escape_markdown(title).replace("[", "⦋").replace("]", "⦌") link = self.URL + data["permalink"] |