PineaFan | 100df68 | 2023-01-02 13:26:08 +0000 | [diff] [blame] | 1 | import type { CommandInteraction } from "discord.js"; |
| 2 | import type Discord from "discord.js"; |
| 3 | import type { SlashCommandSubcommandBuilder } from "@discordjs/builders"; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 4 | import EmojiEmbed from "../../utils/generateEmojiEmbed.js"; |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 5 | import generateKeyValueList from "../../utils/generateKeyValueList.js"; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 6 | import client from "../../utils/client.js"; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 7 | |
| 8 | const command = (builder: SlashCommandSubcommandBuilder) => |
| 9 | builder |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 10 | .setName("avatar") |
| 11 | .setDescription("Shows the avatar of a user") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 12 | .addUserOption((option) => |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 13 | option.setName("user").setDescription("The user to get the avatar of | Default: Yourself") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 14 | ); |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 15 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 16 | const callback = async (interaction: CommandInteraction): Promise<void> => { |
| 17 | const { renderUser } = client.logger; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 18 | const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 19 | 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), |
PineaFan | 100df68 | 2023-01-02 13:26:08 +0000 | [diff] [blame] | 28 | url: member.user.displayAvatarURL({ forceStatic: false }) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 29 | }) |
| 30 | ) |
PineaFan | 100df68 | 2023-01-02 13:26:08 +0000 | [diff] [blame] | 31 | .setImage(member.user.displayAvatarURL({ forceStatic: true })) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 32 | ], |
| 33 | ephemeral: true, |
| 34 | fetchReply: true |
| 35 | }); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 36 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 37 | |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 38 | const check = (_interaction: CommandInteraction) => { |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 39 | return true; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 40 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 41 | |
| 42 | export { command }; |
| 43 | export { callback }; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 44 | export { check }; |