Javascript 如何使我的不和谐从GIF中识别png?
我试图让我的discord机器人打印出用户的头像,但如果作者的头像是png(或任何其他静止图像)或gif,我不知道如何让机器人识别 如中所示,来自Javascript 如何使我的不和谐从GIF中识别png?,javascript,bots,discord,discord.js,gif,Javascript,Bots,Discord,Discord.js,Gif,我试图让我的discord机器人打印出用户的头像,但如果作者的头像是png(或任何其他静止图像)或gif,我不知道如何让机器人识别 如中所示,来自User类的属性avatarURL提供了访问资源的完整URL。该地址可能包含文件的扩展名,您可以使用字符串方法轻松检查该扩展名,如。查看这是否有帮助 module.exports.run = async (bot, message, args) => { message.channel.send({files: [ { attachmen
User
类的属性avatarURL
提供了访问资源的完整URL。该地址可能包含文件的扩展名,您可以使用字符串方法轻松检查该扩展名,如。查看这是否有帮助
module.exports.run = async (bot, message, args) => {
message.channel.send({files: [
{
attachment: message.author.displayAvatarURL,
name: "avatar.png"
}
]});
}
module.exports.help = {
name: "avatar"
}