Skip to content
Advertisement

Small discord.js Avatar image

Avatar issue example

enter image description here

I am trying to do the discord.js avatar command and it works. It sends the image it needs to send but the issue is that the image sent is small compared to other bots. Am using the command handler in the discord.js guide

const Discord = require('discord.js');
module.exports = {
    name: 'avatar',
    description: 'Get the avatar URL of the tagged user(s), or your own avatar.',
    aliases: ['av', 'a'],
    usage: '[commandname]',
    cooldown: 10,
    execute(message) {
        if (!message.mentions.users.size) {
            const embed = new Discord.MessageEmbed()
                .setTitle(message.author.username)
                .setColor(0x00ffff)
                .setImage(message.author.displayAvatarURL({ format: 'png' }));
            return message.channel.send(embed);
        }

        const mention = message.mentions.members.first();
        const Embed = new Discord.MessageEmbed()
            .setTitle(message.mentions.users.first().username)
            .setColor(0x00ffff)
            .setImage(mention.user.displayAvatarURL({ format: 'png' }));
        return message.channel.send(Embed);

    },
};

Advertisement

Answer

You can add a size option like how you did with you format

.displayAvatarURL({ format: 'png', size: size_you_want }));

the size as to be one of the following 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, For more info you can view the options here https://discord.js.org/#/docs/main/stable/typedef/ImageURLOptions

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement