blob: 88b32700d7cf0443fd2bf7e3ac70b98243555800 [file] [log] [blame]
PineaFan100df682023-01-02 13:26:08 +00001import type { CommandInteraction } from "discord.js";
2import type Discord from "discord.js";
3import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
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
PineaFan0d06edc2023-01-17 22:10:31 +000038const check = () => {
pineafan4f164f32022-02-26 22:07:12 +000039 return true;
pineafan63fc5e22022-08-04 22:04:10 +010040};
pineafan4f164f32022-02-26 22:07:12 +000041
42export { command };
43export { callback };
Skyler Grey75ea9172022-08-06 10:22:23 +010044export { check };