aboutsummaryrefslogtreecommitdiff
path: root/bot/src/commands/avatar.js
blob: 2c3cdeb09f4673c316548d44899e8c2416cfbd46 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { SlashCommandBuilder } from 'discord.js';

export default {
    data: new SlashCommandBuilder()
        .setName('avatar')
        .setDescription('Gives the profile picture of the user.')
        .addUserOption(option =>
            option
                .setName('username')
                .setDescription('The user to get the avatar of.')
                .setRequired(false)),

    async execute(interaction) {
        const username = interaction.options.getUser('username');

        if(!username) {
            await interaction.reply(interaction.user.avatarURL({ dynamic: true, format: 'png', size: 1024 }));
        } else {
            await interaction.reply(username.avatarURL({ dynamic: true, format: 'png', size: 1024 }));
        }
    }
};