blob: 6804695f5e63d88382c0059bd32872b105b6454f [file] [log] [blame]
import type { CommandInteraction } from "discord.js";
import type Discord from "discord.js";
import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import generateKeyValueList from "../../utils/generateKeyValueList.js";
import client from "../../utils/client.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("avatar")
.setDescription("Shows the avatar of a user")
.addUserOption((option) =>
option.setName("user").setDescription("The user to get the avatar of | Default: Yourself")
);
const callback = async (interaction: CommandInteraction): Promise<void> => {
const { renderUser } = client.logger;
const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember;
await interaction.reply({
embeds: [
new EmojiEmbed()
.setTitle("User Info")
.setStatus("Success")
.setEmoji("MEMBER.JOIN")
.setDescription(
generateKeyValueList({
member: renderUser(member.user),
url: member.user.displayAvatarURL({ forceStatic: false })
})
)
.setImage(member.user.displayAvatarURL({ forceStatic: true }))
],
ephemeral: true,
fetchReply: true
});
};
export { command };
export { callback };