小编Gal*_*ksy的帖子

如何修复“词法声明不能出现在单语句上下文中”

当我进行嵌入并运行机器人时,这里出现问题,因为我使用了let EmbedHelp = Discord.RichEmbed此问题出现在终端中,请输入问题以及我需要修复的内容:

SyntaxError: Lexical declaration cannot appear in a single-statement context
   at new Script (vm.js:79:7)
   at createScript (vm.js:251:10)
   at Object.runInThisContext (vm.js:303:10)
   at Module._compile (internal/modules/cjs/loader.js:657:28)
   at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
   at Module.load (internal/modules/cjs/loader.js:599:32)
   at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
   at Function.Module._load (internal/modules/cjs/loader.js:530:3)
   at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
   at startup (internal/bootstrap/node.js:283:19) 
Run Code Online (Sandbox Code Playgroud)

我用于嵌入的代码是:

client.on('message', message => {
    if (message.startsWith('$Commands'))

    let EmbedHelp = Discord.RichEmbed()
        "title": "title ~~(did you know you can have markdown here too?)~~",
        "description": "```",
        "url": "https://discordapp.com",
        "color": 192748,
        "timestamp": "Timezone - GGT 3+",
        "footer": …
Run Code Online (Sandbox Code Playgroud)

javascript node.js discord

8
推荐指数
2
解决办法
6万
查看次数

标签 统计

discord ×1

javascript ×1

node.js ×1