0
代碼爲:https://github.com/Zentrik/DiscordBot/blob/master/Bot.js無法獲得YTDL核配discord.js工作
我要麼得到的錯誤:
server.queue.push(args[1]);
^
TypeError: Cannot read property 'queue' of undefined
at Client.<anonymous> (/home/ubuntu/discordbot/bot.js:133:19)
at emitOne (events.js:115:13)
at Client.emit (events.js:210:7)
at MessageCreateHandler.handle (/home/ubuntu/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/home/ubuntu/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (/home/ubuntu/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:330:35)
at WebSocketConnection.onMessage (/home/ubuntu/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:293:17)
at WebSocket.onMessage (/home/ubuntu/node_modules/ws/lib/EventTarget.js:99:16)
at emitOne (events.js:115:13)
at WebSocket.emit (events.js:210:7)
或者:
(node:8565) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'push' of undefined
(node:8565) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我得到這個代碼從這裏:https://www.youtube.com/watch?v=z4S2qqX7YvA
我很確定代碼是一樣的。
該bot加入語音頻道,並有權加入和說話。
我是新來的JavaScript所以我不得到什麼地方出了錯任何幫助,將不勝感激
編輯:有一個拼寫錯誤,我固定的,但現在的音頻完成啓動之後,產生沒有聲音。
服務器[message.guild.id]是[object Object]
server.queue [0]是相同的URL,但後來增加了 '未定義' 到URL的結尾。
server.dispatcher也[object Object]
您可以在此發佈「bot.js」的代碼嗎?圍繞133行似乎有問題,但您提供的GitHub鏈接只有67行。 – skirtle
github鏈接很好,我只是刪除了不必要的和個人信息。錯誤是在線44 – NeonNuke
你確定嗎?錯誤說'server.queue.push(args [1]);'但是看起來並不是第44行。更可能的候選者是第47行,它具有類似的行'servers.queue.push(args [ 1]);'。我說類似,因爲它是'server',而不是'server'。我懷疑GitHub中的代碼需要更改爲'server',但這並不能解釋你所看到的錯誤,它已經說過'server'。 – skirtle