【发布时间】:2020-07-05 05:23:00
【问题描述】:
所以我尝试让一个机器人加入我所在的语音频道,然后让它发送一条消息。问题是我不完全确定我是否以正确的方式使用voiceChannel.join(),因为我收到"Cannot ready property "join" of undefined" 的错误:
client.on('message', msg=>{
if(msg.content === "testing"){
const channel = msg.member.voiceChannel;
channel.join() //voiceChannel.join()
.then(msg.channel.send("!p https://www.youtube.com/watch?v=e-IWRmpefzE"));
}
})
我得到这个错误:
C:\Users\Jakob\Desktop\DiscordBot\index.js:13
channel.join();
^
TypeError: Cannot read property 'join' of undefined
at Client.<anonymous> (C:\Users\Jakob\Desktop\DiscordBot\index.js:13:17)
机器人读取了消息,然后我不完全确定尝试加入时出了什么问题...
【问题讨论】:
标签: javascript discord.js