If we get another .livestream command check if we're in a voice chat and disconnect and rejoin
This commit is contained in:
parent
3dc617b38b
commit
35f08b663a
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
description: 'Starts or stops a live stream in a voice channel with a provided video link.',
|
||||
async execute(message, args, deleteTimeout) {
|
||||
if (args[0] === 'stop') {
|
||||
const voiceState = message.guild.me.voice;
|
||||
const voiceState = message.guild.members.me.voice;
|
||||
if (voiceState.channel) {
|
||||
voiceState.disconnect();
|
||||
return message.channel.send('Livestream stopped.')
|
||||
|
@ -30,6 +30,12 @@ module.exports = {
|
|||
.then(msg => setTimeout(() => msg.delete().catch(console.error), deleteTimeout));
|
||||
}
|
||||
|
||||
const voiceState = message.guild.members.me.voice;
|
||||
if (voiceState.channel) {
|
||||
console.log('Already in a voice channel, leaving...');
|
||||
await voiceState.disconnect();
|
||||
}
|
||||
|
||||
try {
|
||||
if (message.client.currentPlayer) {
|
||||
message.client.currentPlayer.stop();
|
||||
|
|
Loading…
Reference in New Issue