forked from Supositware/Haha-Yes
music command but disable
This commit is contained in:
parent
08bc9dc548
commit
16b820d196
1 changed files with 35 additions and 0 deletions
35
commands/fun/music
Normal file
35
commands/fun/music
Normal file
|
@ -0,0 +1,35 @@
|
|||
const { Command } = require('discord.js-commando');
|
||||
const ytdl = require('ytdl-core');
|
||||
module.exports = class MusicCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'music',
|
||||
group: 'fun',
|
||||
memberName: 'music',
|
||||
description: 'Play youtube link in vocal',
|
||||
args: [
|
||||
{
|
||||
key: 'ytblink',
|
||||
prompt: 'Wich Youtube link would you like to play?',
|
||||
type: 'string',
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(message, { ytblink }) {
|
||||
const { voiceChannel } = message.member;
|
||||
|
||||
if (!voiceChannel) {
|
||||
return message.reply('please join a voice channel first!');
|
||||
}
|
||||
|
||||
voiceChannel.join().then(connection => {
|
||||
const stream = ytdl(ytblink, { filter: 'audioonly' });
|
||||
const dispatcher = connection.playStream(stream);
|
||||
|
||||
|
||||
dispatcher.on('end', () => voiceChannel.leave());
|
||||
});
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue