avatar cmd, .setImage 头像不显示为 gif

avatar cmd, .setImage avatar isn't displayed as a gif

因此,正如您在 scrrenshot 中看到的那样,link 是一个 .gif,但是(您看不到那么明显)“.setImage”不是一个 gif,它是一个 webp,我想知道为什么.

这是我的代码:

module.exports = {
    name: 'avatar',
    aliases: ['ava', 'profilepic', 'profilepicture'],
    description: 'Displays your own avatar or the avatar of a user you emntioned',
    category: "general",
    usage: 'prefix | avatar | mention',
    run : async (message, client, args) => {
        const Discord = require('discord.js');

        if (!message.mentions.users.size) {
            let embed1 = new Discord.MessageEmbed()
                .setColor(color)
                .setTitle(`Your avatar`)
                .setImage(message.author.displayAvatarURL({ format: "png", dynamic: true }))
                .addField(`Link:`, `${message.author.displayAvatarURL({ format: "png", dynamic: true })}`)
            message.channel.send(embed1);
        }
        else{
            const user = message.mentions.users.first()
            let embed2 = new Discord.MessageEmbed()
                .setColor(color)
                .setTitle(`${user.username}'s avatar:`)
                .setImage(user.displayAvatarURL({ format: "png", dynamic: true }))
                .addField(`Link:`, `${user.displayAvatarURL({ format: "png", dynamic: true })}`)
            message.channel.send(embed2);
        }
    }
};

如果有人知道 why/has 解决方案就好了。

{ format: "png", dynamic: true } 并没有真正起作用。动态选项意味着如果头像是动画的则变为 .gif,否则返回 png
因此,如果动态选项为真,则无需使用格式选项。