[fix] Emoji listing
This commit is contained in:
parent
c8428fb231
commit
c3bc03430e
2 changed files with 33 additions and 21 deletions
|
@ -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")
|
@slash_command(name="emotes", description="Get all emotes")
|
||||||
async def _emotes(self, ctx: SlashContext) -> None:
|
async def _emotes(self, ctx: SlashContext) -> None:
|
||||||
emojis = await ctx.guild.fetch_all_custom_emojis()
|
try:
|
||||||
static = len([x for x in emojis if not x.animated])
|
emojis = sorted(
|
||||||
animated = len([x for x in emojis if x.animated])
|
await ctx.guild.fetch_all_custom_emojis(),
|
||||||
|
key=lambda x: x.animated,
|
||||||
|
reverse=True,
|
||||||
|
)
|
||||||
|
static = 0
|
||||||
|
animated = 0
|
||||||
messages = []
|
messages = []
|
||||||
current = ""
|
current = ""
|
||||||
for emoji in emojis:
|
for emoji in emojis:
|
||||||
|
static += not emoji.animated
|
||||||
|
animated += emoji.animated
|
||||||
if len(current) >= 4000:
|
if len(current) >= 4000:
|
||||||
messages.append(current)
|
messages.append(current)
|
||||||
current = ""
|
current = ""
|
||||||
current += f"<{'a:' if emoji.animated else ''}{emoji.name}:{emoji.id}>"
|
current += f"<{'a' if emoji.animated else ''}:{emoji.name}:{emoji.id}> "
|
||||||
messages += current
|
messages.append(current)
|
||||||
embeds = [
|
embeds = [
|
||||||
Embed(
|
Embed(
|
||||||
title=f"{static} Static, {animated} Animated, {len(emojis)} Total",
|
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:]:
|
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(
|
@slash_command(
|
||||||
name="roleinfo",
|
name="roleinfo",
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
from importlib.metadata import version as _v
|
from importlib.metadata import version as _v
|
||||||
|
|
||||||
__version__ = "2.5.2"
|
__version__ = "2.5.3"
|
||||||
|
|
Loading…
Add table
Reference in a new issue