diff options
Diffstat (limited to 'src/commands/info/avatar.ts')
-rw-r--r-- | src/commands/info/avatar.ts | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts new file mode 100644 index 0000000..3d1776f --- /dev/null +++ b/src/commands/info/avatar.ts @@ -0,0 +1,51 @@ +import { Constants } from 'discord-akairo'; +import { MessageEmbed, User } from 'discord.js'; +import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; + +export default class AvatarCommand extends BushCommand { + constructor() { + super('avatar', { + aliases: ['avatar', 'av'], + category: 'info', + description: { + content: "A command to get a user's avatar", + usage: 'avatar [user]', + examples: 'avatar' + }, + args: [ + { + id: 'user', + type: Constants.ArgumentTypes.USER, + match: Constants.ArgumentMatches.PHRASE, + prompt: { + start: 'Who would you like to see the avatar of?', + retry: '{error} Choose a valid user.', + optional: true + } + } + ], + clientPermissions: ['SEND_MESSAGES', 'EMBED_LINKS'], + slash: true, + slashOptions: [ + { + name: 'user', + description: 'The user you would like to find the avatar of.', + type: 'USER', + required: false + } + ] + }); + } + + async exec(message: BushMessage | BushSlashMessage, { user }: { user: User }): Promise<void> { + user = user ?? message.author; + + const embed = new MessageEmbed() + .setTimestamp() + .setColor(this.client.util.colors.default) + .setTitle(user.tag) + .setImage(user.avatarURL({ size: 2048, format: 'png', dynamic: true })); + + await message.util.reply({ embeds: [embed] }); + } +} |