Basic play functionality

This commit is contained in:
Max Isom 2020-03-10 11:58:09 -05:00
parent 652cc2e5ef
commit 8eb4c8a6c0
7 changed files with 159 additions and 4 deletions

21
src/commands/play.ts Normal file
View file

@ -0,0 +1,21 @@
import {CommandHandler} from '../interfaces';
import {getMostPopularVoiceChannel} from '../utils/channels';
import getYouTubeStream from '../utils/get-youtube-stream';
const play: CommandHandler = {
name: 'play',
description: 'plays a song',
execute: async (msg, args) => {
const url = args[0];
const channel = getMostPopularVoiceChannel(msg.guild!);
const conn = await channel.join();
const stream = await getYouTubeStream(url);
conn.play(stream, {type: 'webm/opus'});
}
};
export default play;