mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-10 12:11:35 +02:00
Basic play functionality
This commit is contained in:
parent
652cc2e5ef
commit
8eb4c8a6c0
7 changed files with 159 additions and 4 deletions
21
src/commands/play.ts
Normal file
21
src/commands/play.ts
Normal 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;
|
Loading…
Add table
Add a link
Reference in a new issue