diff options
| author | 2021-04-15 11:19:43 -0400 | |
|---|---|---|
| committer | 2021-04-15 11:19:43 -0400 | |
| commit | 1f2a04870c509b5667d903c187fe05e0796be041 (patch) | |
| tree | 4f4f87c43727533f4744328bedd623b0b47d1fdc | |
| parent | Import unescape directly (diff) | |
Resolved issues
| -rw-r--r-- | bot/exts/info/reddit.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/bot/exts/info/reddit.py b/bot/exts/info/reddit.py index 9c026caca..e1f0c5f9f 100644 --- a/bot/exts/info/reddit.py +++ b/bot/exts/info/reddit.py @@ -180,8 +180,7 @@ class Reddit(Cog): for post in posts: data = post["data"] - text = unescape(data["selftext"]) - if text: + if text := unescape(data["selftext"]): text = textwrap.shorten(text, width=128, placeholder="...") text += "\n" # Add newline to separate embed info @@ -189,8 +188,7 @@ class Reddit(Cog): comments = data["num_comments"] author = data["author"] - title = unescape(data["title"]) - title = textwrap.shorten(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"] |