Javascript Discord.js无法读取属性';推动';未定义的 const Discord=require('Discord.js'); const serverQueue=require('./play.js'); 常量ytdl=require('ytdl-core'); module.exports.run=async(bot、消息、args)=>{ const voiceChannel=message.member.voice.channel; 如果(!语音频道) 返回message.channel.send( “**您需要进入语音频道才能播放音乐:无输入:!**” ); const permissions=voiceChannel.permissions(message.client.user); 如果(!permissions.has('CONNECT')) 返回message.channel.send( “**我没有足够的权限:没有输入:!**” ); 如果(!permissions.has('SPEAK')) 返回message.channel.send( “**我没有足够的权限:没有输入:!**” ); const songInfo=wait ytdl.getInfo(args[0]); 康斯特宋={ 标题:songInfo.title, 网址:songInfo.video_网址, }; 如果(!serverQueue){ 常量队列构造={ text频道:message.channel, voiceChannel:voice.channel, 连接:空, 歌曲:[], 第5卷, 演奏:是的, }; queue.set(message.guild.id,queueConstruct); queueConstruct.songs.push(song); 试一试{ var connection=wait voiceChannel.join(); queueConstruct.connection=连接; 播放(message.guild、queueConstruct.songs[0]); }捕获(错误){ log(`连接到语音频道时出错:${error}`); queue.delete(message.guild.id); 返回message.channel.send( `连接到语音频道时出错:${error}` ); } }否则{ serverQueue.songs.push(歌曲); 返回message.channel.send( `**${song.title}已添加到队列:白色\u复选标记:**` ); } 返回未定义; 功能播放(公会、歌曲){ const serverQueue=queue.get(guild.id); 如果(!歌曲){ serverQueue.voiceChannel.leave(); queue.delete(guild.id); 返回; } const dispatcher=serverQueue.connection .play(ytdl(song.url)) .on('finish',()=>{ serverQueue.songs.shift(); 播放(帮会、服务器队列、歌曲[0]); }) .on('错误',(错误)=>{ console.log(错误); }); dispatcher.setVolumeLogarithmic(serverQueue.volume/5); } };

Javascript Discord.js无法读取属性';推动';未定义的 const Discord=require('Discord.js'); const serverQueue=require('./play.js'); 常量ytdl=require('ytdl-core'); module.exports.run=async(bot、消息、args)=>{ const voiceChannel=message.member.voice.channel; 如果(!语音频道) 返回message.channel.send( “**您需要进入语音频道才能播放音乐:无输入:!**” ); const permissions=voiceChannel.permissions(message.client.user); 如果(!permissions.has('CONNECT')) 返回message.channel.send( “**我没有足够的权限:没有输入:!**” ); 如果(!permissions.has('SPEAK')) 返回message.channel.send( “**我没有足够的权限:没有输入:!**” ); const songInfo=wait ytdl.getInfo(args[0]); 康斯特宋={ 标题:songInfo.title, 网址:songInfo.video_网址, }; 如果(!serverQueue){ 常量队列构造={ text频道:message.channel, voiceChannel:voice.channel, 连接:空, 歌曲:[], 第5卷, 演奏:是的, }; queue.set(message.guild.id,queueConstruct); queueConstruct.songs.push(song); 试一试{ var connection=wait voiceChannel.join(); queueConstruct.connection=连接; 播放(message.guild、queueConstruct.songs[0]); }捕获(错误){ log(`连接到语音频道时出错:${error}`); queue.delete(message.guild.id); 返回message.channel.send( `连接到语音频道时出错:${error}` ); } }否则{ serverQueue.songs.push(歌曲); 返回message.channel.send( `**${song.title}已添加到队列:白色\u复选标记:**` ); } 返回未定义; 功能播放(公会、歌曲){ const serverQueue=queue.get(guild.id); 如果(!歌曲){ serverQueue.voiceChannel.leave(); queue.delete(guild.id); 返回; } const dispatcher=serverQueue.connection .play(ytdl(song.url)) .on('finish',()=>{ serverQueue.songs.shift(); 播放(帮会、服务器队列、歌曲[0]); }) .on('错误',(错误)=>{ console.log(错误); }); dispatcher.setVolumeLogarithmic(serverQueue.volume/5); } };,javascript,node.js,discord,discord.js,ytdl,Javascript,Node.js,Discord,Discord.js,Ytdl,TypeError:无法读取未定义的属性“push” 请忽略这一点:快速棕色狐狸跳过了懒狗,快速棕色狐狸跳过了懒狗,快速棕色狐狸跳过了懒狗,快速棕色狐狸跳过了懒狗,快速棕色狐狸跳过了懒狗。您遇到的错误意味着您要推送的数组未定义或不存在。 尝试在push语句之前使用console.log(队列构造)检查队列构造中的数据是否显示在控制台上 如果显示未定义,请尝试将常量更改为变量。此处,您可以编辑您希望我编辑的内容吗?我已经编辑过了。您可以现在将其签出,查看它是否工作编辑,然后保存它。这应该是一个新的

TypeError:无法读取未定义的属性“push”


请忽略这一点:快速棕色狐狸跳过了懒狗,快速棕色狐狸跳过了懒狗,快速棕色狐狸跳过了懒狗,快速棕色狐狸跳过了懒狗,快速棕色狐狸跳过了懒狗。

您遇到的错误意味着您要推送的数组未定义或不存在。 尝试在push语句之前使用
console.log(队列构造)
检查队列构造中的数据是否显示在控制台上


如果显示未定义,请尝试将常量更改为变量。

此处,您可以编辑您希望我编辑的内容吗?我已经编辑过了。您可以现在将其签出,查看它是否工作编辑,然后保存它。这应该是一个新的链接。然后您可以将其发送回。这里有6个错误:if(!serverQueue){const queueConstruct={textChannel:message.channel,voiceChannel:voice.channel,connection:null,songs:[],volume:5,playing:true}只需将引号添加到您看到的数组中即可