From c8428fb231e0eebc97e7d51b48df8f7ec4fce0f8 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Mon, 4 Mar 2024 19:46:35 -0700 Subject: [PATCH] [feat] Add emotes command --- jarvis/cogs/core/util.py | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/jarvis/cogs/core/util.py b/jarvis/cogs/core/util.py index a8840aa..90b8b99 100644 --- a/jarvis/cogs/core/util.py +++ b/jarvis/cogs/core/util.py @@ -1,4 +1,5 @@ """JARVIS Utility Cog.""" + import logging import re import secrets @@ -13,7 +14,7 @@ from interactions import Client, Extension, SlashContext from interactions import __version__ as ipyv from interactions.models.discord.channel import GuildCategory, GuildText, GuildVoice from interactions.models.discord.components import Button -from interactions.models.discord.embed import EmbedField +from interactions.models.discord.embed import EmbedField, Embed from interactions.models.discord.enums import ButtonStyle from interactions.models.discord.file import File from interactions.models.discord.guild import Guild @@ -230,6 +231,31 @@ Tips will be used to pay server costs, and any excess will go to local animal sh ) await ctx.send(embeds=embed, components=components) + @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", + ) + ] + for message in messages[1:]: + embeds.append(description=message, color="#3498db") + + await ctx.send(embeds=embeds) + @slash_command( name="roleinfo", description="Get role info", @@ -331,9 +357,9 @@ Tips will be used to pay server costs, and any excess will go to local animal sh ), EmbedField( name=f"Roles [{len(user_roles)}]", - value=" ".join([x.mention for x in user_roles]) - if user_roles - else "None", + value=( + " ".join([x.mention for x in user_roles]) if user_roles else "None" + ), inline=False, ), ]