diff options
| -rw-r--r-- | bot/exts/evergreen/emoji_count.py | 18 | 
1 files changed, 9 insertions, 9 deletions
| diff --git a/bot/exts/evergreen/emoji_count.py b/bot/exts/evergreen/emoji_count.py index fba7216c..0c18c9ee 100644 --- a/bot/exts/evergreen/emoji_count.py +++ b/bot/exts/evergreen/emoji_count.py @@ -2,7 +2,7 @@ import datetime  import logging  import random  from collections import defaultdict -from typing import Tuple +from typing import List, Tuple  import discord  from discord.ext import commands @@ -20,7 +20,7 @@ class EmojiCount(commands.Cog):          self.bot = bot      @staticmethod -    def embed_builder(emoji: dict) -> Tuple[discord.Embed, str]: +    def embed_builder(emoji: dict) -> Tuple[discord.Embed, List[str]]:          """Generates an embed with the emoji names and count."""          embed = discord.Embed(              color=Colours.orange, @@ -37,7 +37,7 @@ class EmojiCount(commands.Cog):          else:              for category_name, category_emojis in emoji.items():                  emoji_choice = random.choice(category_emojis) -                emoji_info = f'There are **{len(category_emojis)}** emojis in the **{category_name}** category\n' +                emoji_info = f'There are **{len(category_emojis)}** emojis in the **{category_name}** category'                  if emoji_choice.animated:                      msg.append(f'<a:{emoji_choice.name}:{emoji_choice.id}> {emoji_info}')                  else: @@ -45,7 +45,7 @@ class EmojiCount(commands.Cog):          return embed, msg      @staticmethod -    def generate_invalid_embed(ctx: commands.Context) -> Tuple[discord.Embed, str]: +    def generate_invalid_embed(emojis: list) -> Tuple[discord.Embed, List[str]]:          """Generates error embed."""          embed = discord.Embed(              color=Colours.soft_red, @@ -54,15 +54,15 @@ class EmojiCount(commands.Cog):          msg = []          emoji_dict = defaultdict(list) -        for emoji in ctx.guild.emojis: +        for emoji in emojis:              emoji_dict[emoji.name.split("_")[0]].append(emoji)          error_comp = ', '.join(emoji_dict)          msg.append(f"These are the valid categories\n```{error_comp}```")          return embed, msg -    @commands.command(name="emojis_count", aliases=["ec"]) -    async def emojis_count(self, ctx: commands.Context, *, category_query: str = None) -> None: +    @commands.command(name="emoji_count", aliases=["ec", "emojis"]) +    async def emoji_count(self, ctx: commands.Context, *, category_query: str = None) -> None:          """Returns embed with emoji category and info given by the user."""          emoji_dict = defaultdict(list) @@ -78,9 +78,9 @@ class EmojiCount(commands.Cog):              emoji_dict[emoji_category].append(emoji) -        if len(emoji_dict) == 0: +        if not emoji_dict:              log.trace("Invalid name provided by the user") -            embed, msg = self.generate_invalid_embed(ctx) +            embed, msg = self.generate_invalid_embed(ctx.guild.emojis)          else:              embed, msg = self.embed_builder(emoji_dict)          await LinePaginator.paginate(lines=msg, ctx=ctx, embed=embed) | 
