diff --git a/jarvis/cogs/core/util.py b/jarvis/cogs/core/util.py index 90b8b99..f34b867 100644 --- a/jarvis/cogs/core/util.py +++ b/jarvis/cogs/core/util.py @@ -233,28 +233,40 @@ Tips will be used to pay server costs, and any excess will go to local animal sh @slash_command(name="emotes", description="Get all emotes") async def _emotes(self, ctx: SlashContext) -> None: - emojis = await ctx.guild.fetch_all_custom_emojis() - static = len([x for x in emojis if not x.animated]) - animated = len([x for x in emojis if x.animated]) - messages = [] - current = "" - for emoji in emojis: - if len(current) >= 4000: - messages.append(current) - current = "" - current += f"<{'a:' if emoji.animated else ''}{emoji.name}:{emoji.id}>" - messages += current - embeds = [ - Embed( - title=f"{static} Static, {animated} Animated, {len(emojis)} Total", - description=messages[0], - color="#3498db", + try: + emojis = sorted( + await ctx.guild.fetch_all_custom_emojis(), + key=lambda x: x.animated, + reverse=True, ) - ] - for message in messages[1:]: - embeds.append(description=message, color="#3498db") + static = 0 + animated = 0 + messages = [] + current = "" + for emoji in emojis: + static += not emoji.animated + animated += emoji.animated + if len(current) >= 4000: + messages.append(current) + current = "" + current += f"<{'a' if emoji.animated else ''}:{emoji.name}:{emoji.id}> " + messages.append(current) + embeds = [ + Embed( + title=f"{static} Static, {animated} Animated, {len(emojis)} Total", + description=messages[0], + color="#3498db", + ) + ] + for message in messages[1:]: + embeds.append(Embed(description=message, color="#3498db")) - await ctx.send(embeds=embeds) + message = await ctx.send(embeds=embeds[:10]) + for i in range(10, len(embeds), 10): + await message.reply(embeds=embeds[i : i + 10]) + + except Exception as e: + self.logger.error("Encountered error: {e}", exc_info=True) @slash_command( name="roleinfo", diff --git a/jarvis/const.py b/jarvis/const.py index 31088b3..eb34ab3 100644 --- a/jarvis/const.py +++ b/jarvis/const.py @@ -2,4 +2,4 @@ from importlib.metadata import version as _v -__version__ = "2.5.2" +__version__ = "2.5.3"