pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 1 | import Discord, { CommandInteraction } from "discord.js"; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 2 | import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; |
| 3 | import { WrappedCheck } from "jshaiku"; |
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 getEmojiByName from "../../utils/getEmojiByName.js"; |
| 6 | import generateKeyValueList from "../../utils/generateKeyValueList.js"; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame^] | 7 | import client from "../../utils/client.js" |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 8 | |
| 9 | const command = (builder: SlashCommandSubcommandBuilder) => |
| 10 | builder |
| 11 | .setName("avatar") |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 12 | .setDescription("Shows the avatar of a user") |
| 13 | .addUserOption(option => option.setName("user").setDescription("The user to get the avatar of | Default: Yourself")) |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 14 | |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame^] | 15 | const callback = async (interaction: CommandInteraction): Promise<any> => { |
PineappleFan | b3dd83c | 2022-06-17 10:53:48 +0100 | [diff] [blame] | 16 | const { renderUser } = client.logger |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 17 | let member = (interaction.options.getMember("user") || interaction.member) as Discord.GuildMember; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame^] | 18 | await interaction.reply({embeds: [new EmojiEmbed() |
pineafan | 377794f | 2022-04-18 19:01:01 +0100 | [diff] [blame] | 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}); |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | export { command }; |
| 37 | export { callback }; |
| 38 | export { check }; |