1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
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: 'user',
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
}
]
});
}
override async exec(message: BushMessage | BushSlashMessage, { user }: { user: User }): Promise<void> {
user = user ?? message.author;
const embed = new MessageEmbed()
.setTimestamp()
.setColor(util.colors.default)
.setTitle(`${user.tag}'s Avatar`)
.setImage(
user.avatarURL({ size: 2048, format: 'png', dynamic: true }) ?? 'https://cdn.discordapp.com/embed/avatars/0.png'
);
await message.util.reply({ embeds: [embed] });
}
}
|