Music now work, bot can leave the channel
This commit is contained in:
parent
3ef3d787f1
commit
889cef0f8f
1 changed files with 4 additions and 1 deletions
|
@ -10,7 +10,7 @@ module.exports = class MusicCommand extends Command {
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'ytblink',
|
key: 'ytblink',
|
||||||
prompt: 'Wich Youtube link would you like to play?',
|
prompt: 'Wich Youtube link would you like to play? (stop to make the bot leave the channel)',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -24,6 +24,9 @@ module.exports = class MusicCommand extends Command {
|
||||||
return message.reply('please join a voice channel first!');
|
return message.reply('please join a voice channel first!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ytblink == 'stop') {
|
||||||
|
voiceChannel.leave()
|
||||||
|
} else
|
||||||
voiceChannel.join().then(connection => {
|
voiceChannel.join().then(connection => {
|
||||||
const stream = ytdl(ytblink, { filter: 'audioonly' });
|
const stream = ytdl(ytblink, { filter: 'audioonly' });
|
||||||
const dispatcher = connection.playStream(stream);
|
const dispatcher = connection.playStream(stream);
|
Loading…
Reference in a new issue