blob: da33f5121e306c0d8d971f13d40b99272d944543 [file] [log] [blame]
PineaFan100df682023-01-02 13:26:08 +00001import type { CommandInteraction } from "discord.js";
2import type Discord from "discord.js";
Samuel Shuert27bf3cd2023-03-03 15:51:25 -05003import type { SlashCommandSubcommandBuilder } from "discord.js";
pineafan4edb7762022-06-26 19:21:04 +01004import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
pineafan377794f2022-04-18 19:01:01 +01005import generateKeyValueList from "../../utils/generateKeyValueList.js";
pineafan63fc5e22022-08-04 22:04:10 +01006import client from "../../utils/client.js";
pineafan4f164f32022-02-26 22:07:12 +00007
8const command = (builder: SlashCommandSubcommandBuilder) =>
9 builder
pineafan63fc5e22022-08-04 22:04:10 +010010 .setName("avatar")
11 .setDescription("Shows the avatar of a user")
Skyler Grey75ea9172022-08-06 10:22:23 +010012 .addUserOption((option) =>
Skyler Grey11236ba2022-08-08 21:13:33 +010013 option.setName("user").setDescription("The user to get the avatar of | Default: Yourself")
Skyler Grey75ea9172022-08-06 10:22:23 +010014 );
pineafan4f164f32022-02-26 22:07:12 +000015
pineafan63fc5e22022-08-04 22:04:10 +010016const callback = async (interaction: CommandInteraction): Promise<void> => {
17 const { renderUser } = client.logger;
Skyler Grey11236ba2022-08-08 21:13:33 +010018 const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember;
Skyler Grey75ea9172022-08-06 10:22:23 +010019 await interaction.reply({
20 embeds: [
21 new EmojiEmbed()
22 .setTitle("User Info")
23 .setStatus("Success")
24 .setEmoji("MEMBER.JOIN")
25 .setDescription(
26 generateKeyValueList({
27 member: renderUser(member.user),
PineaFan100df682023-01-02 13:26:08 +000028 url: member.user.displayAvatarURL({ forceStatic: false })
Skyler Grey75ea9172022-08-06 10:22:23 +010029 })
30 )
PineaFan100df682023-01-02 13:26:08 +000031 .setImage(member.user.displayAvatarURL({ forceStatic: true }))
Skyler Grey75ea9172022-08-06 10:22:23 +010032 ],
33 ephemeral: true,
34 fetchReply: true
35 });
pineafan63fc5e22022-08-04 22:04:10 +010036};
pineafan4f164f32022-02-26 22:07:12 +000037
pineafan4f164f32022-02-26 22:07:12 +000038
39export { command };
40export { callback };