blob: eb9042a739a9730fff54c8873bcf963ac7aab90e [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";
3import { WrappedCheck } from "jshaiku";
pineafan377794f2022-04-18 19:01:01 +01004import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
5import getEmojiByName from "../../utils/getEmojiByName.js";
6import generateKeyValueList from "../../utils/generateKeyValueList.js";
pineafan4f164f32022-02-26 22:07:12 +00007
8const command = (builder: SlashCommandSubcommandBuilder) =>
9 builder
10 .setName("avatar")
pineafan377794f2022-04-18 19:01:01 +010011 .setDescription("Shows the avatar of a user")
12 .addUserOption(option => option.setName("user").setDescription("The user to get the avatar of | Default: Yourself"))
pineafan4f164f32022-02-26 22:07:12 +000013
pineafan377794f2022-04-18 19:01:01 +010014const callback = async (interaction: CommandInteraction) => {
15 // @ts-ignore
16 const { renderUser } = interaction.client.logger
17 let member = (interaction.options.getMember("user") || interaction.member) as Discord.GuildMember;
18 await interaction.reply({embeds: [new generateEmojiEmbed()
19 .setTitle("User Info")
20 .setStatus("Success")
21 .setEmoji("MEMBER.JOIN")
22 .setDescription(
23 generateKeyValueList({
24 "member": renderUser(member.user),
25 "url": member.user.displayAvatarURL({dynamic: true}),
26 })
27 )
28 .setImage(await member.user.displayAvatarURL({dynamic: true}))
29 ], ephemeral: true, fetchReply: true});
pineafan4f164f32022-02-26 22:07:12 +000030}
31
32const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
33 return true;
34}
35
36export { command };
37export { callback };
38export { check };