aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2020-03-10 11:58:09 -0500
committerMax Isom <[email protected]>2020-03-10 11:58:09 -0500
commit8eb4c8a6c06f672cb50efae5ea30215d465000af (patch)
tree938a439e254694b4ed283d71a303b442ba739104 /src/commands
parent652cc2e5efed6ddef593570ee90634cbc1c452bb (diff)
downloadmuse-8eb4c8a6c06f672cb50efae5ea30215d465000af.tar.xz
muse-8eb4c8a6c06f672cb50efae5ea30215d465000af.zip
Basic play functionality
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/play.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/commands/play.ts b/src/commands/play.ts
new file mode 100644
index 0000000..cf23d60
--- /dev/null
+++ b/src/commands/play.ts
@@ -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;