[fix] Emoji listing

This commit is contained in:
Zeva Rose 2024-03-04 20:03:52 -07:00
parent c8428fb231
commit c3bc03430e
2 changed files with 33 additions and 21 deletions

View file

@ -233,17 +233,24 @@ 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])
try:
emojis = sorted(
await ctx.guild.fetch_all_custom_emojis(),
key=lambda x: x.animated,
reverse=True,
)
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 += 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",
@ -252,9 +259,14 @@ Tips will be used to pay server costs, and any excess will go to local animal sh
)
]
for message in messages[1:]:
embeds.append(description=message, color="#3498db")
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",

View file

@ -2,4 +2,4 @@
from importlib.metadata import version as _v
__version__ = "2.5.2"
__version__ = "2.5.3"