[fix] Emoji listing
This commit is contained in:
parent
c8428fb231
commit
c3bc03430e
2 changed files with 33 additions and 21 deletions
|
@ -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",
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
from importlib.metadata import version as _v
|
||||
|
||||
__version__ = "2.5.2"
|
||||
__version__ = "2.5.3"
|
||||
|
|
Loading…
Add table
Reference in a new issue