需要声明或声明

时间:2020-06-06 12:31:32

标签: discord.js

我有

“需要声明或声明”

错误,有人知道为什么吗?

module.exports = {
    name: 'profil',
    description: 'Informacje o użytkowniku',
    execute(message, args) {
        const embed = new Discord.MessageEmbed();
        .setTitle('Informacje o użytkowniku')
        .addField('Nazwa użytkownika', message.author.username, true)
        .addField('Obecny Serwer', message.guild.name, true)
        .setColor(0xF1C40F)
        .setThumbnail(message.author.displayAvatarURL(),
        message.channel.send(embed)),
    }

1 个答案:

答案 0 :(得分:0)

此行:

const embed = new Discord.MessageEmbed();

结尾不应使用分号,因为您直接访问其方法。

另外,您可能希望首先实例化embed作为变量,然后将其单独发送:

const embed = new Discord.MessageEmbed()
    .setTitle('Informacje o użytkowniku')
    .addField('Nazwa użytkownika', message.author.username, true)
    .addField('Obecny Serwer', message.guild.name, true)
    .setColor(0xF1C40F)
    .setThumbnail(message.author.avatarURL());

message.channel.send(embed);