0

所以它没有像应该那样发送头像作为图像,但也没有错误,所以我想我忘记了什么?

execute(message, args) {
            const Discord = require('discord.js');

            if (!message.mentions.users.size) {
                let embed1 = new Discord.MessageEmbed()
                            .setColor('0x0099ff')
                            .setDescription(`Your avatar:`)
                            .setImage(message.author.avatarURL)
                            .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('0x0099ff')
                        .setDescription(`${user.username}'s avatar:`)
                        .setImage(user.avatarURL)
                        .addField(`Link:`, `${user.displayAvatarURL({ format: "png", dynamic: true })}`)
                message.channel.send(embed2);
            }
        },
4

1 回答 1

1

您通常希望使用User#displayAvatarURL而不是 User#avatarURL。

编辑:显然,这些属性现在是方法。把 () 放在avatarURLand之后displayAvatarURL使它们工作。

于 2020-05-01T18:42:54.203 回答