From 8f5494727d81be7190537f130ef9b384c9e72285 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 13:44:09 +0530 Subject: inital commit --- bot/exts/evergreen/emoji_count.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 bot/exts/evergreen/emoji_count.py (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py new file mode 100644 index 00000000..b619f349 --- /dev/null +++ b/bot/exts/evergreen/emoji_count.py @@ -0,0 +1,29 @@ +import logging + +from discord.ext import commands + +log = logging.getLogger(__name__) + + +class EmojiCount(commands.Cog): + """Command that give random emoji based on category.""" + + def __init__(self, bot: commands.Bot): + self.bot = bot + + @commands.command(name="ec") + async def ec(self, ctx, emoj: str): + """Returns embed with emoji category and info given by user.""" + emoji = [] + for a in ctx.guild.emojis: + for n in a.name.split('_'): + if len(n) == 1: + pass + elif n.name[0] == emoji.lower(): + emoji.append(a) + await ctx.send(emoji) + + +def setup(bot: commands.Bot) -> None: + """Emoji Count Cog load.""" + bot.add_cog(EmojiCount(bot)) -- cgit v1.2.3 From 2e8a0396586dfdb9eaff8a308ef39736ccdaffb3 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Thu, 1 Oct 2020 19:00:56 +0530 Subject: removed --- bot/exts/evergreen/emoji_count.py | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 bot/exts/evergreen/emoji_count.py (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py deleted file mode 100644 index b619f349..00000000 --- a/bot/exts/evergreen/emoji_count.py +++ /dev/null @@ -1,29 +0,0 @@ -import logging - -from discord.ext import commands - -log = logging.getLogger(__name__) - - -class EmojiCount(commands.Cog): - """Command that give random emoji based on category.""" - - def __init__(self, bot: commands.Bot): - self.bot = bot - - @commands.command(name="ec") - async def ec(self, ctx, emoj: str): - """Returns embed with emoji category and info given by user.""" - emoji = [] - for a in ctx.guild.emojis: - for n in a.name.split('_'): - if len(n) == 1: - pass - elif n.name[0] == emoji.lower(): - emoji.append(a) - await ctx.send(emoji) - - -def setup(bot: commands.Bot) -> None: - """Emoji Count Cog load.""" - bot.add_cog(EmojiCount(bot)) -- cgit v1.2.3 From 1f2d9a09b4aabbae0f5859ea0d909e80aaef194a Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 2 Oct 2020 16:53:59 +0530 Subject: added embed_builder_method,error_embed_method --- bot/exts/evergreen/emoji_count.py | 80 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 bot/exts/evergreen/emoji_count.py (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py new file mode 100644 index 00000000..2f20dbed --- /dev/null +++ b/bot/exts/evergreen/emoji_count.py @@ -0,0 +1,80 @@ +import datetime +import logging +import random +from typing import Dict, Optional + +import discord +from discord.ext import commands + +from bot.constants import Colours + +log = logging.getLogger(__name__) + + +class EmojiCount(commands.Cog): + """Command that give random emoji based on category.""" + + def __init__(self, bot: commands.Bot): + self.bot = bot + + def embed_builder(self, emoji: dict) -> discord.Embed: + """Genrates embed with emoji name and count.""" + embed = discord.Embed() + embed.color = Colours.orange + embed.title = "Emoji Count" + embed.timestamp = datetime.datetime.utcnow() + if len(emoji) == 1: + for key, value in emoji.items(): + print(key) + embed.description = f"There are **{len(value)}** emojis in the **{key}** category" + embed.set_thumbnail(url=random.choice(value).url) + else: + msg = '' + for key, value in emoji.items(): + emoji_choice = random.choice(value) + error_msg = f'There are **{len(value)}** emojis in the **{key}** category\n' + msg += f'<:{emoji_choice.name}:{emoji_choice.id}> {error_msg}' + embed.description = msg + return embed + + @staticmethod + def generate_invalid_embed(ctx) -> discord.Embed: + """Genrates error embed.""" + embed = discord.Embed() + embed.color = Colours.soft_red + embed.title = "Invalid Input" + emoji_dict = {} + for emoji in ctx.guild.emojis: + emoji_dict.update({emoji.name.split("_")[0]: []}) + error_comp = ', '.join(key for key in emoji_dict.keys()) + embed.description = f"These are the valid categories\n```{error_comp}```" + return embed + + def emoji_list(self, ctx, emojis: dict) -> Dict: + """Genrates dictionary of emojis given by the user.""" + for emoji in ctx.guild.emojis: + for key, value in emojis.items(): + if emoji.name.split("_")[0] == key: + value.append(emoji) + return emojis + + @commands.command(name="ec") + async def ec(self, ctx, *, emoji: str = None) -> Optional[str]: + """Returns embed with emoji category and info given by user.""" + emoji_dict = {} + for a in ctx.guild.emojis: + if emoji is None: + emoji_dict.update({a.name.split("_")[0]: []}) + elif a.name.split("_")[0] in emoji: + emoji_dict.update({a.name.split("_")[0]: []}) + emoji_dict = self.emoji_list(ctx, emoji_dict) + if len(emoji_dict) == 0: + embed = self.generate_invalid_embed(ctx) + else: + embed = self.embed_builder(emoji_dict) + await ctx.send(embed=embed) + + +def setup(bot: commands.Bot) -> None: + """Emoji Count Cog load.""" + bot.add_cog(EmojiCount(bot)) -- cgit v1.2.3 From c9cdb2b5005bd20f881b5b7d2ed5fcef0d66b0c9 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 2 Oct 2020 17:03:07 +0530 Subject: added logging --- bot/exts/evergreen/emoji_count.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index 2f20dbed..a90c1b7d 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -35,6 +35,7 @@ class EmojiCount(commands.Cog): error_msg = f'There are **{len(value)}** emojis in the **{key}** category\n' msg += f'<:{emoji_choice.name}:{emoji_choice.id}> {error_msg}' embed.description = msg + log.trace('Emoji embed sent') return embed @staticmethod @@ -48,6 +49,7 @@ class EmojiCount(commands.Cog): emoji_dict.update({emoji.name.split("_")[0]: []}) error_comp = ', '.join(key for key in emoji_dict.keys()) embed.description = f"These are the valid categories\n```{error_comp}```" + log.trace("Error embed sent") return embed def emoji_list(self, ctx, emojis: dict) -> Dict: @@ -56,6 +58,7 @@ class EmojiCount(commands.Cog): for key, value in emojis.items(): if emoji.name.split("_")[0] == key: value.append(emoji) + log.trace("Emoji dict sent") return emojis @commands.command(name="ec") @@ -64,15 +67,20 @@ class EmojiCount(commands.Cog): emoji_dict = {} for a in ctx.guild.emojis: if emoji is None: + log.trace("Emoji Category doesn't provided by the user") emoji_dict.update({a.name.split("_")[0]: []}) elif a.name.split("_")[0] in emoji: + log.trace("Emoji Category provided by the user") emoji_dict.update({a.name.split("_")[0]: []}) emoji_dict = self.emoji_list(ctx, emoji_dict) if len(emoji_dict) == 0: embed = self.generate_invalid_embed(ctx) + log.trace("Error embed received") else: embed = self.embed_builder(emoji_dict) + log.trace("Emoji embed received") await ctx.send(embed=embed) + log.trace("Embed sent") def setup(bot: commands.Bot) -> None: -- cgit v1.2.3 From e9de05b77f886dffacca9cdee53dd1a424913fb9 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 2 Oct 2020 17:25:49 +0530 Subject: added ctx annotation --- bot/exts/evergreen/emoji_count.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index a90c1b7d..fa0879ae 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -39,7 +39,7 @@ class EmojiCount(commands.Cog): return embed @staticmethod - def generate_invalid_embed(ctx) -> discord.Embed: + def generate_invalid_embed(ctx: commands.Context) -> discord.Embed: """Genrates error embed.""" embed = discord.Embed() embed.color = Colours.soft_red @@ -52,7 +52,7 @@ class EmojiCount(commands.Cog): log.trace("Error embed sent") return embed - def emoji_list(self, ctx, emojis: dict) -> Dict: + def emoji_list(self, ctx: commands.Context, emojis: dict) -> Dict: """Genrates dictionary of emojis given by the user.""" for emoji in ctx.guild.emojis: for key, value in emojis.items(): @@ -62,7 +62,7 @@ class EmojiCount(commands.Cog): return emojis @commands.command(name="ec") - async def ec(self, ctx, *, emoji: str = None) -> Optional[str]: + async def ec(self, ctx: commands.Context, *, emoji: str = None) -> Optional[str]: """Returns embed with emoji category and info given by user.""" emoji_dict = {} for a in ctx.guild.emojis: -- cgit v1.2.3 From 8cc34b61f59f685344654d35791d0a722dd3d735 Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Fri, 2 Oct 2020 18:06:06 +0530 Subject: Update bot/exts/evergreen/emoji_count.py Co-authored-by: Matteo Bertucci --- bot/exts/evergreen/emoji_count.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index fa0879ae..2e6c5638 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -18,7 +18,7 @@ class EmojiCount(commands.Cog): self.bot = bot def embed_builder(self, emoji: dict) -> discord.Embed: - """Genrates embed with emoji name and count.""" + """Generates an embed with the emoji names and count.""" embed = discord.Embed() embed.color = Colours.orange embed.title = "Emoji Count" -- cgit v1.2.3 From 7cf5afb3ac29b9752e4b89da7b0c8dacd4e6313a Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Fri, 2 Oct 2020 18:07:43 +0530 Subject: Update bot/exts/evergreen/emoji_count.py Co-authored-by: Matteo Bertucci --- bot/exts/evergreen/emoji_count.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index 2e6c5638..4b35c619 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -67,7 +67,7 @@ class EmojiCount(commands.Cog): emoji_dict = {} for a in ctx.guild.emojis: if emoji is None: - log.trace("Emoji Category doesn't provided by the user") + log.trace("Emoji Category not provided by the user") emoji_dict.update({a.name.split("_")[0]: []}) elif a.name.split("_")[0] in emoji: log.trace("Emoji Category provided by the user") -- cgit v1.2.3 From 40f0c0e5b5c361ca3acf5e39b55470d2b9ea0bc4 Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Fri, 2 Oct 2020 18:10:04 +0530 Subject: removed update and added data to dict directly Co-authored-by: Matteo Bertucci --- bot/exts/evergreen/emoji_count.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index 4b35c619..e9bd8c35 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -46,7 +46,7 @@ class EmojiCount(commands.Cog): embed.title = "Invalid Input" emoji_dict = {} for emoji in ctx.guild.emojis: - emoji_dict.update({emoji.name.split("_")[0]: []}) + emoji_dict[emoji.name.split("_")[0]] = [] error_comp = ', '.join(key for key in emoji_dict.keys()) embed.description = f"These are the valid categories\n```{error_comp}```" log.trace("Error embed sent") -- cgit v1.2.3 From 1c5f5837714b71ef93ee9eeac32e74df09a585d9 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 2 Oct 2020 18:15:41 +0530 Subject: changed error_msg to emoji_info --- bot/exts/evergreen/emoji_count.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index fa0879ae..95e4c927 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -32,8 +32,8 @@ class EmojiCount(commands.Cog): msg = '' for key, value in emoji.items(): emoji_choice = random.choice(value) - error_msg = f'There are **{len(value)}** emojis in the **{key}** category\n' - msg += f'<:{emoji_choice.name}:{emoji_choice.id}> {error_msg}' + emoji_info = f'There are **{len(value)}** emojis in the **{key}** category\n' + msg += f'<:{emoji_choice.name}:{emoji_choice.id}> {emoji_info}' embed.description = msg log.trace('Emoji embed sent') return embed @@ -61,7 +61,7 @@ class EmojiCount(commands.Cog): log.trace("Emoji dict sent") return emojis - @commands.command(name="ec") + @commands.command(name="emoji_count", aliases=["ec"]) async def ec(self, ctx: commands.Context, *, emoji: str = None) -> Optional[str]: """Returns embed with emoji category and info given by user.""" emoji_dict = {} -- cgit v1.2.3 From 480cc1b56077c76b42c9102ae6320c4801b1719b Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 2 Oct 2020 18:31:40 +0530 Subject: removed print statement,changed logging msg and changed emoji list --- bot/exts/evergreen/emoji_count.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index 95e4c927..ecdb12fa 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -6,7 +6,7 @@ from typing import Dict, Optional import discord from discord.ext import commands -from bot.constants import Colours +from bot.constants import Colours, ERROR_REPLIES log = logging.getLogger(__name__) @@ -25,7 +25,6 @@ class EmojiCount(commands.Cog): embed.timestamp = datetime.datetime.utcnow() if len(emoji) == 1: for key, value in emoji.items(): - print(key) embed.description = f"There are **{len(value)}** emojis in the **{key}** category" embed.set_thumbnail(url=random.choice(value).url) else: @@ -35,7 +34,7 @@ class EmojiCount(commands.Cog): emoji_info = f'There are **{len(value)}** emojis in the **{key}** category\n' msg += f'<:{emoji_choice.name}:{emoji_choice.id}> {emoji_info}' embed.description = msg - log.trace('Emoji embed sent') + log.trace('Emoji embed built') return embed @staticmethod @@ -43,23 +42,25 @@ class EmojiCount(commands.Cog): """Genrates error embed.""" embed = discord.Embed() embed.color = Colours.soft_red - embed.title = "Invalid Input" + embed.title = random.choice(ERROR_REPLIES) emoji_dict = {} for emoji in ctx.guild.emojis: emoji_dict.update({emoji.name.split("_")[0]: []}) error_comp = ', '.join(key for key in emoji_dict.keys()) embed.description = f"These are the valid categories\n```{error_comp}```" - log.trace("Error embed sent") + log.trace("Error embed built") return embed - def emoji_list(self, ctx: commands.Context, emojis: dict) -> Dict: - """Genrates dictionary of emojis given by the user.""" + def emoji_list(self, ctx, categories) -> Dict: + """Generates an embed with the emoji names and count.""" + out = {category: [] for category in categories} + for emoji in ctx.guild.emojis: - for key, value in emojis.items(): - if emoji.name.split("_")[0] == key: - value.append(emoji) - log.trace("Emoji dict sent") - return emojis + category = emoji.name.split('_')[0] + if category in out: + out[category].append(emoji) + log.trace("Emoji dict built") + return out @commands.command(name="emoji_count", aliases=["ec"]) async def ec(self, ctx: commands.Context, *, emoji: str = None) -> Optional[str]: -- cgit v1.2.3 From d4b4885751a0830f684ac8cd95636abe2439b432 Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Fri, 2 Oct 2020 18:34:41 +0530 Subject: added annotation --- bot/exts/evergreen/emoji_count.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index ecdb12fa..c303cb7e 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -51,7 +51,7 @@ class EmojiCount(commands.Cog): log.trace("Error embed built") return embed - def emoji_list(self, ctx, categories) -> Dict: + def emoji_list(self, ctx: commands.Context, categories: dict) -> Dict: """Generates an embed with the emoji names and count.""" out = {category: [] for category in categories} @@ -64,7 +64,7 @@ class EmojiCount(commands.Cog): @commands.command(name="emoji_count", aliases=["ec"]) async def ec(self, ctx: commands.Context, *, emoji: str = None) -> Optional[str]: - """Returns embed with emoji category and info given by user.""" + """Returns embed with emoji category and info given by the user.""" emoji_dict = {} for a in ctx.guild.emojis: if emoji is None: -- cgit v1.2.3 From 38968a545f3f237542448e4853d18e274c63e86d Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Sat, 3 Oct 2020 12:44:19 +0530 Subject: Update bot/exts/evergreen/emoji_count.py Co-authored-by: ks129 <45097959+ks129@users.noreply.github.com> --- bot/exts/evergreen/emoji_count.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index 3ad0d61b..b32fd0ed 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -40,9 +40,10 @@ class EmojiCount(commands.Cog): @staticmethod def generate_invalid_embed(ctx: commands.Context) -> discord.Embed: """Genrates error embed.""" - embed = discord.Embed() - embed.color = Colours.soft_red - embed.title = random.choice(ERROR_REPLIES) + embed = discord.Embed( + color=Colours.soft_red, + title=random.choice(ERROR_REPLIES) + ) emoji_dict = {} for emoji in ctx.guild.emojis: emoji_dict[emoji.name.split("_")[0]] = [] -- cgit v1.2.3 From 33b2c6bb8de14d277709af3a24072d2b2e6e61f9 Mon Sep 17 00:00:00 2001 From: Anubhav <57266248+Anubhav1603@users.noreply.github.com> Date: Sat, 3 Oct 2020 12:44:32 +0530 Subject: Update bot/exts/evergreen/emoji_count.py Co-authored-by: ks129 <45097959+ks129@users.noreply.github.com> --- bot/exts/evergreen/emoji_count.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index b32fd0ed..c8076922 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -19,10 +19,11 @@ class EmojiCount(commands.Cog): def embed_builder(self, emoji: dict) -> discord.Embed: """Generates an embed with the emoji names and count.""" - embed = discord.Embed() - embed.color = Colours.orange - embed.title = "Emoji Count" - embed.timestamp = datetime.datetime.utcnow() + embed = discord.Embed( + color=Colours.orange, + title="Emoji Count", + timestamp=datetime.datetime.utcnow() + ) if len(emoji) == 1: for key, value in emoji.items(): embed.description = f"There are **{len(value)}** emojis in the **{key}** category" -- cgit v1.2.3 From 7c76f01c8dacdcd954758bcb5078672a86286f2c Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sat, 3 Oct 2020 13:23:58 +0530 Subject: removed unnecessary logging and added one space --- bot/exts/evergreen/emoji_count.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index c8076922..70c5ff53 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -35,7 +35,6 @@ class EmojiCount(commands.Cog): emoji_info = f'There are **{len(value)}** emojis in the **{key}** category\n' msg += f'<:{emoji_choice.name}:{emoji_choice.id}> {emoji_info}' embed.description = msg - log.trace('Emoji embed built') return embed @staticmethod @@ -45,12 +44,13 @@ class EmojiCount(commands.Cog): color=Colours.soft_red, title=random.choice(ERROR_REPLIES) ) + emoji_dict = {} for emoji in ctx.guild.emojis: emoji_dict[emoji.name.split("_")[0]] = [] + error_comp = ', '.join(key for key in emoji_dict.keys()) embed.description = f"These are the valid categories\n```{error_comp}```" - log.trace("Error embed built") return embed def emoji_list(self, ctx: commands.Context, categories: dict) -> Dict: @@ -61,7 +61,6 @@ class EmojiCount(commands.Cog): category = emoji.name.split('_')[0] if category in out: out[category].append(emoji) - log.trace("Emoji dict built") return out @commands.command(name="emoji_count", aliases=["ec"]) @@ -78,12 +77,9 @@ class EmojiCount(commands.Cog): emoji_dict = self.emoji_list(ctx, emoji_dict) if len(emoji_dict) == 0: embed = self.generate_invalid_embed(ctx) - log.trace("Error embed received") else: embed = self.embed_builder(emoji_dict) - log.trace("Emoji embed received") await ctx.send(embed=embed) - log.trace("Embed sent") def setup(bot: commands.Bot) -> None: -- cgit v1.2.3 From fcc345ae802cfe7815e10bc13f972c6925f3c60f Mon Sep 17 00:00:00 2001 From: Anubhav1603 Date: Sun, 4 Oct 2020 12:24:31 +0530 Subject: cleaned the code --- bot/exts/evergreen/emoji_count.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bot') diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index 70c5ff53..ef900199 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -24,6 +24,7 @@ class EmojiCount(commands.Cog): title="Emoji Count", timestamp=datetime.datetime.utcnow() ) + if len(emoji) == 1: for key, value in emoji.items(): embed.description = f"There are **{len(value)}** emojis in the **{key}** category" @@ -67,6 +68,7 @@ class EmojiCount(commands.Cog): async def ec(self, ctx: commands.Context, *, emoji: str = None) -> Optional[str]: """Returns embed with emoji category and info given by the user.""" emoji_dict = {} + for a in ctx.guild.emojis: if emoji is None: log.trace("Emoji Category not provided by the user") @@ -74,7 +76,9 @@ class EmojiCount(commands.Cog): elif a.name.split("_")[0] in emoji: log.trace("Emoji Category provided by the user") emoji_dict.update({a.name.split("_")[0]: []}) + emoji_dict = self.emoji_list(ctx, emoji_dict) + if len(emoji_dict) == 0: embed = self.generate_invalid_embed(ctx) else: -- cgit v1.2.3