[feat] Add emotes command
This commit is contained in:
parent
cd3e0314a9
commit
c8428fb231
1 changed files with 30 additions and 4 deletions
|
@ -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,
|
||||
),
|
||||
]
|
||||
|
|
Loading…
Add table
Reference in a new issue