首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >预期声明或声明

问预期声明或声明
EN

Stack Overflow用户
提问于 2020-06-06 12:31:32
回答 1查看 251关注 0票数 0

我有过

“预期声明或声明”

错误,有人知道原因吗?

代码语言:javascript
复制
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)),
    }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-06-06 12:52:31

这一行:

代码语言:javascript
复制
const embed = new Discord.MessageEmbed();

不应该在末尾有分号,因为您直接访问它的方法。

此外,您可能需要先实例化嵌入变量,然后单独发送:

代码语言:javascript
复制
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);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62231758

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档