diff options
author | 2019-10-29 13:44:13 +0100 | |
---|---|---|
committer | 2019-10-29 13:51:58 +0100 | |
commit | 1a1ef440aa8c1c63e9ed38742641d18da68c30c3 (patch) | |
tree | 33b114e190664321a614edf676cb35e2f6db018b | |
parent | Merge pull request #527 from kraktus/compact_free (diff) |
Enhance Reddit webhook embeds
https://github.com/python-discord/bot/issues/634
I have changes the appearance of the embed generated for the reddit
webhook. The changes:
- Bold markdown around the links to prevent it breaking on android.
- Stylized the meta-data line with newly created emoji-based icons.
- Removed redundant mentions of the subreddit from the embed itself.
The emojis were uploaded to the `Emojis II` guild and the IDs have
been added to the constants files. In addition, I've set the reddit
logo as the default avatar for the webhook in the guild.
This commit closes #634
-rw-r--r-- | bot/cogs/reddit.py | 6 | ||||
-rw-r--r-- | bot/constants.py | 4 | ||||
-rw-r--r-- | config-default.yml | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/bot/cogs/reddit.py b/bot/cogs/reddit.py index 7749d237f..f947a7d78 100644 --- a/bot/cogs/reddit.py +++ b/bot/cogs/reddit.py @@ -9,7 +9,7 @@ from discord import Colour, Embed, TextChannel from discord.ext.commands import Bot, Cog, Context, group from discord.ext.tasks import loop -from bot.constants import Channels, ERROR_REPLIES, Reddit as RedditConfig, STAFF_ROLES, Webhooks +from bot.constants import Channels, ERROR_REPLIES, Emojis, Reddit as RedditConfig, STAFF_ROLES, Webhooks from bot.converters import Subreddit from bot.decorators import with_role from bot.pagination import LinePaginator @@ -117,9 +117,9 @@ class Reddit(Cog): link = self.URL + data["permalink"] embed.description += ( - f"[**{title}**]({link})\n" + f"**[{title}]({link})**\n" f"{text}" - f"| {ups} upvotes | {comments} comments | u/{author} | {subreddit} |\n\n" + f"{Emojis.upvotes} {ups} {Emojis.comments} {comments} {Emojis.user} {author}\n\n" ) embed.colour = Colour.blurple() diff --git a/bot/constants.py b/bot/constants.py index 838fe7a79..d3e79b4c2 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -259,6 +259,10 @@ class Emojis(metaclass=YAMLGetter): pencil: str cross_mark: str + upvotes: str + comments: str + user: str + class Icons(metaclass=YAMLGetter): section = "style" diff --git a/config-default.yml b/config-default.yml index 4638a89ee..9c7830077 100644 --- a/config-default.yml +++ b/config-default.yml @@ -37,6 +37,10 @@ style: new: "\U0001F195" cross_mark: "\u274C" + upvotes: "<:upvotes:638706000714792962>" + comments: "<:comments:638706001159258132>" + user: "<:user:638706001217978368>" + icons: crown_blurple: "https://cdn.discordapp.com/emojis/469964153289965568.png" crown_green: "https://cdn.discordapp.com/emojis/469964154719961088.png" |