【发布时间】:2019-07-08 18:49:29
【问题描述】:
我的机器人不能离开语音频道,但它可以加入任何人。我有两个代码,一个是“离开”,另一个是“stopstream”,它说“无法读取未定义的属性'channelID'”和“(节点:11416)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性'voiceChannel' " 一个复杂的代码
我尝试使用不同的代码,其中一个比另一个复杂。并输入“const ytdl = require('ytdl-core'); const streamOptions = { seek: 0, volume: 1 };" 在复数中。
//leave
const ytdl = require('ytdl-core');
const streamOptions = { seek: 0, volume: 1 };
exports.run = async (client, message, args, ops) => {
if (!message.member.voiceChannel) return message.channel.send('Please connect to a voice chanel, don\'t be afraid my child. Share you beautiful voice.');
if (!message.guild.mne.voiceChannel) return message.channel.send('Sorry, I\'m not connected to the guild.');
if (message.guild.me.voiceChannelID !== message.member.voiceChannelID) return message.chanel.send('Sorry, you aren\t connected to the same channel, I\'ll give you some PeterFriffinCoins, for free.');
message.guild.me.voiceChannel.leave();
message.channel.send('Leaving Channel... I\'m a free elf...')
}
//stopstream
exports.run = (client, message, args) => {
client.leaveVoiceChannel(message.member.voiceState.channelID);
message.channel.send('Thanks for tuning in!');
}
【问题讨论】:
标签: javascript discord