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