blob: 00be0c990c3c61426b8725a9595e2fb1852b8710 [file] [log] [blame]
pineafan377794f2022-04-18 19:01:01 +01001import Discord, { CommandInteraction } from "discord.js";
pineafan4f164f32022-02-26 22:07:12 +00002import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
pineafan4edb7762022-06-26 19:21:04 +01003import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
pineafan377794f2022-04-18 19:01:01 +01004import generateKeyValueList from "../../utils/generateKeyValueList.js";
pineafan63fc5e22022-08-04 22:04:10 +01005import client from "../../utils/client.js";
pineafan4f164f32022-02-26 22:07:12 +00006
7const command = (builder: SlashCommandSubcommandBuilder) =>
8 builder
pineafan63fc5e22022-08-04 22:04:10 +01009 .setName("avatar")
10 .setDescription("Shows the avatar of a user")
Skyler Grey75ea9172022-08-06 10:22:23 +010011 .addUserOption((option) =>
Skyler Grey11236ba2022-08-08 21:13:33 +010012 option.setName("user").setDescription("The user to get the avatar of | Default: Yourself")
Skyler Grey75ea9172022-08-06 10:22:23 +010013 );
pineafan4f164f32022-02-26 22:07:12 +000014
pineafan63fc5e22022-08-04 22:04:10 +010015const callback = async (interaction: CommandInteraction): Promise<void> => {
16 const { renderUser } = client.logger;
Skyler Grey11236ba2022-08-08 21:13:33 +010017 const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember;
Skyler Grey75ea9172022-08-06 10:22:23 +010018 await interaction.reply({
19 embeds: [
20 new EmojiEmbed()
21 .setTitle("User Info")
22 .setStatus("Success")
23 .setEmoji("MEMBER.JOIN")
24 .setDescription(
25 generateKeyValueList({
26 member: renderUser(member.user),
27 url: member.user.displayAvatarURL({ dynamic: true })
28 })
29 )
Skyler Greyc634e2b2022-08-06 17:50:48 +010030 .setImage(member.user.displayAvatarURL({ dynamic: true }))
Skyler Grey75ea9172022-08-06 10:22:23 +010031 ],
32 ephemeral: true,
33 fetchReply: true
34 });
pineafan63fc5e22022-08-04 22:04:10 +010035};
pineafan4f164f32022-02-26 22:07:12 +000036
PineaFan64486c42022-12-28 09:21:04 +000037const check = (_interaction: CommandInteraction) => {
pineafan4f164f32022-02-26 22:07:12 +000038 return true;
pineafan63fc5e22022-08-04 22:04:10 +010039};
pineafan4f164f32022-02-26 22:07:12 +000040
41export { command };
42export { callback };
Skyler Grey75ea9172022-08-06 10:22:23 +010043export { check };