Please describe the problem you are having in as much detail as possible:
In this version, when I updated the files, Bot was unable to reproduce the user's avatar correctly, if the user had a gif, he could not reproduce the gif or the original resolution of the user's avatar ... I assumed it was a bug in API ... it didn't just happen on my bot, on other bots too, I have a friend who had a similar problem when updating files ... the command I used to update files is => npm upgrade --save
@SergioGlorias
Include a reproducible code sample here, if possible:
const Discord = require("discord.js")
const fs = require("fs");
module.exports = {
name: "avatar",
run : async (bot, message, args) => {
await bot.users.fetch(args[0]).then(async ()=>{
let user1 = await bot.users.fetch(args[0])
let user= message.author;
let avatar5 = user1.displayAvatarURL({ size: 1024 })
if (avatar5.endsWith(".webp?size=1024")) {avatar5 = user1.displayAvatarURL({ format: 'png', size: 1024 })}
var embed1 = new Discord.MessageEmbed()
.setImage(avatar5)
.setColor(0xff0000)
.setTitle(`Avatar do ${user1.tag} `)
.setDescription(`<@!${user.id}>`+" Clique aqui =>"+"[Download]("+avatar5+")")
.setFooter(`Comando executado por: ${message.author.tag}`,(message.author.displayAvatarURL()))
message.channel.send(embed1);
}) }}
Further details:
This is the expected behavior as of #3530
Accessing the avatar via .displayAvatarURL({ dynamic: true, format: 'png', size: 1024 }); will result in what you are trying to handle with the conditional modification of the URL natively now: provide the image as .png if it is not a gif, else .gif
relevant documentation:
If true, the format will dynamically change to gif for animated avatars; the default is false.
https://discord.js.org/#/docs/main/master/typedef/ImageURLOptions
For future reference:
Edit:
[...] he could not reproduce the gif or the original resolution of the user's avatar
I can not reproduce this problem vector, even with the exact code you provide the size is correctly set to 1024.
additional notes:
You are only doing webp image instead of gif for those with animated avatar
really the error is the (dynamic) that I didn't introduce in the code, because I already checked the Discord.js Guide and didn't see any changes ...
Thanks for everything, sorry for the inconvenience

This is a rather recent change not yet covered on the guide, thanks for the heads up, we should definitely add a notice about that!