aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts
diff options
context:
space:
mode:
authorGravatar AtieP <[email protected]>2020-09-28 16:55:11 +0200
committerGravatar AtieP <[email protected]>2020-09-28 16:55:11 +0200
commit9813bedd3945d5efb42c6e5ca61782604ae8a343 (patch)
treebbab9ef346c5c7a4fd8dfc50430ca36715b575b7 /bot/exts
parentAdd time utils (diff)
Add emojis cog
Diffstat (limited to 'bot/exts')
-rw-r--r--bot/exts/evergreen/emojis.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/bot/exts/evergreen/emojis.py b/bot/exts/evergreen/emojis.py
new file mode 100644
index 00000000..67331941
--- /dev/null
+++ b/bot/exts/evergreen/emojis.py
@@ -0,0 +1,39 @@
+import textwrap
+
+from discord import Color, Embed, Emoji
+from discord.ext import commands
+
+from bot.utils.time import time_since
+
+
+class Emojis(commands.Cog):
+ """Has commands related to emojis."""
+
+ @commands.group(name="emoji", invoke_without_command=True)
+ async def emojis_group(self, ctx: commands.Context, emoji: Emoji) -> None:
+ """A group of commands related to emojis."""
+ # No parameters = same as invoking info subcommand
+ await ctx.invoke(self.info_command, emoji)
+
+ @emojis_group.command(name="info")
+ async def info_command(self, ctx: commands.Context, emoji: Emoji) -> None:
+ """Returns relevant information about a Discord Emoji."""
+ emoji_information = Embed(
+ title=f'Information about "{emoji.name}"',
+ description=textwrap.dedent(f"""
+ Name: {emoji.name}
+ Created: {time_since(emoji.created_at)}
+ ID: {emoji.id}
+ Emote source: [Link]({emoji.url})
+ """),
+ color=Color.blurple()
+ )
+ emoji_information.set_thumbnail(
+ url=str(emoji.url)
+ )
+ await ctx.send(embed=emoji_information)
+
+
+def setup(bot: commands.Bot) -> None:
+ """Add the Emojis cog into the bot."""
+ bot.add_cog(Emojis())