blob: 9a8411889894c04d1cb11db8265e0f0e3920e798 [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";
PineappleFanb3dd83c2022-06-17 10:53:48 +01007import client from "../../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
pineafan377794f2022-04-18 19:01:01 +010015const callback = async (interaction: CommandInteraction) => {
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;
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 };