我試圖用discord.js包啓動我自己的Discord bot。我跟蹤了一個視頻教程,其中涉及設置bot API令牌並打開c9.io帳戶,但是一旦我嘗試運行我的測試腳本,我遇到了問題。c9 nodejs上的Discord.js工作區
不管我嘗試它的代碼,我發現了以下錯誤: /home/ubuntu/workspace/node_modules/discord.js/src/client/Client.js:17 類客戶端擴展EventEmitter { ^ ^^^^
/home/ubuntu/workspace/node_modules/discord.js/src/client/Client.js:17
class Client extends EventEmitter { ^^^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/home/ubuntu/workspace/node_modules/discord.js/src/index.js:1:78)
at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10)
我嘗試以下的教程:https://www.youtube.com/watch?v=0kOyAxOIBUs
測試代碼: VAR不和諧=要求( 'discord.js'); var bot = new Discord.Client(); (該腳本的其餘部分基本上是視頻中的內容,減去評論以及用我的身份驗證令牌代替。)
您不清楚你在問什麼。 – baranskistad