Labib Khan
Labib Khan

Reputation: 13

Why discord.js avatar command give low resolution pic?

I make an avatar command but it works but it give e low-resolution pic example image example

My Code:

module.exports = {
  name: 'avt',
  description: "Used of user avatar",
  execute(message, args, Discord) {
        const user = message.mentions.users.first() || message.author;
    const avatarEmbed = new Discord.MessageEmbed()
        .setColor(0x333333)
        .setAuthor(user.username)
        .setImage(user.avatarURL({size: 2048,
            dynamic: true, }));
    message.channel.send(avatarEmbed);
  }
}

Upvotes: 1

Views: 349

Answers (1)

Veric
Veric

Reputation: 11

You should try chaning the image format to PNG or JPG. Don't worry, if the avatar is animated, the format will automatically be set to GIF.

If the image remains in low resolution, try changing the size to 4096.

module.exports = {
  name: 'avt',
  description: "Used of user avatar",
  execute(message, args, Discord) {
    const user = message.mentions.users.first() || message.author;
    const avatarEmbed = new Discord.MessageEmbed()
        .setColor(0x333333)
        .setAuthor(user.username)
        .setImage(user.displayAvatarURL({ format: 'png', size: 2048, dynamic: true }));
    message.channel.send(avatarEmbed);
  }
}

Upvotes: 1

Related Questions