blob: e72506f2c108664cfc2f99abcea39d8bf941d3f5 [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";
pineafan4edb7762022-06-26 19:21:04 +01004import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
pineafan377794f2022-04-18 19:01:01 +01005import getEmojiByName from "../../utils/getEmojiByName.js";
6import generateKeyValueList from "../../utils/generateKeyValueList.js";
pineafan4edb7762022-06-26 19:21:04 +01007import client from "../../utils/client.js"
pineafan4f164f32022-02-26 22:07:12 +00008
9const command = (builder: SlashCommandSubcommandBuilder) =>
10 builder
11 .setName("avatar")
pineafan377794f2022-04-18 19:01:01 +010012 .setDescription("Shows the avatar of a user")
13 .addUserOption(option => option.setName("user").setDescription("The user to get the avatar of | Default: Yourself"))
pineafan4f164f32022-02-26 22:07:12 +000014
pineafan4edb7762022-06-26 19:21:04 +010015const callback = async (interaction: CommandInteraction): Promise<any> => {
PineappleFanb3dd83c2022-06-17 10:53:48 +010016 const { renderUser } = client.logger
pineafan377794f2022-04-18 19:01:01 +010017 let member = (interaction.options.getMember("user") || interaction.member) as Discord.GuildMember;
pineafan4edb7762022-06-26 19:21:04 +010018 await interaction.reply({embeds: [new EmojiEmbed()
pineafan377794f2022-04-18 19:01:01 +010019 .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 };