Javascript 化身cmd、.setImage化身不';t以gif格式显示
因此,正如您在scrrenshot中看到的,链接是.gif,但“.setImage”不是gif,而是webp,我想知道为什么 这是我的密码:Javascript 化身cmd、.setImage化身不';t以gif格式显示,javascript,discord,discord.js,gif,avatar,Javascript,Discord,Discord.js,Gif,Avatar,因此,正如您在scrrenshot中看到的,链接是.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',
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);
}
}
};
如果有人知道为什么/有解决方案,那就太好了。{format:“png”,dynamic:true}
实际上不起作用。动态选项表示如果头像已设置动画,则变为.gif
,否则使用png
返回所以,若dynamic选项为true,则不需要使用format选项