summaryrefslogtreecommitdiff
path: root/src/commands/user/pfp.ts
blob: ac26a260dd608f9045c76c7c162268429f304dd7 (plain) (blame)
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
import { Command, CommandoMessage } from 'discord.js-commando';
import { MessageEmbed } from 'discord.js';
import emoji from 'emoji-random';

module.exports = class PFPServer extends Command {
    constructor(client) {
        super(client, {
            name: 'pfp',
            aliases: [
                'profilepicture',
                'profile-picture',
                'profileimage',
                'profile-image',
                'avatar',
                'avi'
            ],
            group: 'user',
            memberName: 'pfp',
            description: 'Grabs the profile picture of a specified user.',
            args: [
                {
                    key: 'userID',
                    prompt: 'Which user\'s profile picture would you like to grab?',
                    type: 'string'
                }
            ],
            examples: ['uwu!pfp @sin#1337'],
            throttling: {
                usages: 5,
                duration: 30
            },
            guildOnly: true
        });
    }
    run(msg: CommandoMessage, { userID } ) {
        userID = msg.mentions.users.first()?.id;
        this.client.users.fetch(userID).then(user => {
            let emb = new MessageEmbed()
                .setColor(0xFFCC4D)
                .setTitle(`${msg.mentions.users.first()?.username}'s Profile Picture ` + emoji.random())
                .setImage(user.avatarURL())
            msg.say(emb)
        })
    }
};