Javascript discord.js对play函数的反应

Javascript discord.js对play函数的反应,javascript,discord.js,Javascript,Discord.js,我很确定这意味着消息没有定义,但为什么我认为我定义了它?有人知道问题出在哪里吗?我尽力了。它发送此错误(连接到语音频道时出错:TypeError:无法读取未定义的属性“react”) 功能播放(公会、歌曲、客户端、消息){ const serverQueue=client.queue.get(guild.id) const loop=client.loop.get(guild.id) console.log(循环) 如果(!歌曲){ serverQueue.voiceChannel.leave(

我很确定这意味着消息没有定义,但为什么我认为我定义了它?有人知道问题出在哪里吗?我尽力了。它发送此错误(连接到语音频道时出错:TypeError:无法读取未定义的属性“react”)

功能播放(公会、歌曲、客户端、消息){
const serverQueue=client.queue.get(guild.id)
const loop=client.loop.get(guild.id)
console.log(循环)
如果(!歌曲){
serverQueue.voiceChannel.leave()
client.queue.delete(guild.id)
返回
}
const dispatcher=serverQueue.connection.play(ytdl(song.url))
.on('finish',()=>{
if(循环===未定义){
serverQueue.songs.shift()
}
播放(公会、服务器队列、歌曲[0]、客户端、消息)
})
.on('error',error=>{
console.log(错误)
})
dispatcher.setVolumeLogarithmic(serverQueue.volume/5)
if(循环===未定义){
const reaction=(reaction)=>reaction.emoji.name=='⏭️';
serverQueue.textChannel.send(`Playing:*${song.title}**`)
message.react('⏭️') 
.then(console.log)
.catch(控制台错误);
message.waitingreactions((reaction)=>(reaction.emoji.name=='⏭️'),
{max:1})。然后(收集=>{
if(collected.first().emoji.name=='⏭️') {
如果(!message.member.voice.channel)返回message.channel.send(“您需要在语音频道中才能跳过音乐”)
if(!serverQueue)返回message.channel.send(“无需播放”)
serverQueue.connection.dispatcher.end()
client.loop.delete(message.guild.id)
}
返回未定义
})
}
}

你是对的。在
play(){…}
函数中,你试图调用
.react()
on
undefined
。你能给这个问题提供更多的上下文吗?就像调用上下文一样,看看为什么
play(){}
没有收到第四个参数message的值。

你是对的。在
play(){…}函数中
您尝试调用的函数
.react()
on
undefined
。您能为这个问题提供更多的上下文吗?像调用上下文一样,看看为什么
play(){}
的第四个参数message没有收到任何值。

如果您需要,我可以向您发送整个代码,谢谢,我看不到
play()的上下文
调用了在
121
行定义的函数。调用它的是什么?是上面的函数,因此函数播放是从上面定义的,至少我所做的是在
hatebin
上提供的示例中,没有第四个
参数传递给
137行的函数。如果您愿意,我可以将整个代码发送给您谢谢,我看不到
play()的上下文
调用了在
121
行定义的函数。调用它的是什么?它是上面的函数,因此函数播放是从上面定义的,至少我所做的是在
hatebin
上提供的示例中,没有第四个
参数传递给
137
行的函数。