我在 .setColor 上的不和谐机器人上的声明或声明 expected.ts(1128)

时间:2021-02-18 12:21:59

标签: javascript node.js discord discord.js

我在我的不和谐机器人上编写嵌入代码,然后当我尝试运行它时,代码给了我一个错误:

Declaration or statement expected.ts(1128) C:\Users\jerem\OneDrive\Desktop\AriaBot\index.js:23
                .setColor('#53BBFF')
                ^

SyntaxError: Unexpected token '.'
    at wrapSafe (node:internal/modules/cjs/loader:1018:16)
    at Module._compile (node:internal/modules/cjs/loader:1066:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47`

我不知道出了什么问题,这是我的完整代码,有人能帮我吗?

picture one of my code

picture of my code half 2

1 个答案:

答案 0 :(得分:0)

在调用 ; 构造函数后,您有一个 RichEmbed,实质上是结束它。

你现在输入的内容是这样的

const roleEmbed = new Discord.RichEmbed();.setColor(...)

去掉分号。