I am making a discord bot that is being activated by voice recognition, im at the very beginning right now im making him join a voice channel (which is working), and im trying to make a command to make him leave.
const commando = require('discord.js-commando');
class LeaveChannelCommand extends commando.Command
{
constructor(client){!
super(client,{
name: 'leave',
group: 'music',
memberName: 'leave',
description: 'leaves a voice channel'
});
}
async run(message, args)
{
if(message.guild.voiceConnection)
{
message.guild.voiceConnection.disconnect();
}
else
{
message.channel.sendMessage("seccessfully left")
}
}
}
module.exports = LeaveChannelCommand;
right now you can type !leave from anywhere in the server and the bot leaves, i want to make it possible to control him only from the same voice channel, what should i do