summaryrefslogtreecommitdiff
path: root/src/commands/voice
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-13 05:32:35 -0700
committer8cy <[email protected]>2020-04-13 05:32:35 -0700
commit9dff52f7d047c905326bc2f476ede5463e00f2a0 (patch)
tree1fec8563b3b72fde9b2ab7ad9e56a97398798685 /src/commands/voice
parenttypescript (diff)
downloads5nical-9dff52f7d047c905326bc2f476ede5463e00f2a0.tar.xz
s5nical-9dff52f7d047c905326bc2f476ede5463e00f2a0.zip
typescript final
Diffstat (limited to 'src/commands/voice')
-rw-r--r--src/commands/voice/abee.js197
-rw-r--r--src/commands/voice/fart.js209
-rw-r--r--src/commands/voice/itemshop.js211
-rw-r--r--src/commands/voice/join.js29
-rw-r--r--src/commands/voice/leave.js32
-rw-r--r--src/commands/voice/loop.js32
-rw-r--r--src/commands/voice/moan.js30
-rw-r--r--src/commands/voice/pause.js30
-rw-r--r--src/commands/voice/play.js290
-rw-r--r--src/commands/voice/psycho.js196
-rw-r--r--src/commands/voice/queue.js49
-rw-r--r--src/commands/voice/remove.js39
-rw-r--r--src/commands/voice/resume.js30
-rw-r--r--src/commands/voice/shuffle.js51
-rw-r--r--src/commands/voice/skip.js27
-rw-r--r--src/commands/voice/skipall.js42
-rw-r--r--src/commands/voice/skipto.js41
-rw-r--r--src/commands/voice/squeak.js29
-rw-r--r--src/commands/voice/volume.js43
-rw-r--r--src/commands/voice/wahoo.js30
20 files changed, 1637 insertions, 0 deletions
diff --git a/src/commands/voice/abee.js b/src/commands/voice/abee.js
new file mode 100644
index 0000000..9dfda85
--- /dev/null
+++ b/src/commands/voice/abee.js
@@ -0,0 +1,197 @@
+const ytdl = require('ytdl-core');
+const { Command } = require('discord.js-commando');
+const { MessageEmbed } = require('discord.js');
+const Youtube = require('simple-youtube-api');
+//const { youtubeAPI } = require('../../config.json');
+const youtube = new Youtube('AIzaSyB9xJENORzZt-GmOGx4WsNCPgKSIxhJcds');
+const emoji = require('emoji-random');
+
+module.exports = class ABeeVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'abee',
+ aliases: ['a-bee'],
+ group: 'voice',
+ memberName: 'abee',
+ description: 'a bee :D 🐝',
+ guildOnly: true,
+ clientPermissions: ['SPEAK', 'CONNECT'],
+ examples: ['s5n!abee', 's5n!a-bee']
+ });
+ }
+ async run(msg) {
+ const voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.say('join a channel and try again ' + emoji.random());
+
+ const id = 'lvdnhWhQBdo';
+ const video = await youtube.getVideoByID(id).catch(function () {
+ return msg.say(
+ 'there was a problem getting the video you provided ' + emoji.random()
+ );
+ });
+ // // can be uncommented if you don't want the bot to play live streams
+ // if (video.raw.snippet.liveBroadcastContent === 'live') {
+ // return msg.say("I don't support live streams!");
+ // }
+ // // can be uncommented if you don't want the bot to play videos longer than 1 hour
+ // if (video.duration.hours !== 0) {
+ // return msg.say('I cannot play videos longer than 1 hour');
+ // }
+ // // can be uncommented if you want to limit the queue
+ // if (msg.guild.musicData.queue.length > 10) {
+ // return msg.say(
+ // 'There are too many songs in the queue already, skip or wait a bit'
+ // );
+ // }
+ msg.guild.musicData.queue.push(
+ this.constructSongObj(video, voiceChannel)
+ );
+ if (
+ msg.guild.musicData.isPlaying == false ||
+ typeof msg.guild.musicData.isPlaying == 'undefined'
+ ) {
+ msg.guild.musicData.isPlaying = true;
+ return this.playSong(msg.guild.musicData.queue, msg);
+ } else if (msg.guild.musicData.isPlaying == true) {
+ return msg.say(`${video.title} added to queue ` + emoji.random());
+ }
+
+ var that = this;
+ msg.channel
+ .awaitMessages(
+ function (msg) {
+ return (msg.content > 0 && msg.content < 6) || msg.content === 'exit';
+ }, {
+ max: 1,
+ time: 60000,
+ errors: ['time']
+ }
+ )
+ .then(function (response) {
+ const videoIndex = parseInt(response.first().content);
+ if (response.first().content === 'exit') return songEmbed.delete();
+ youtube
+ .getVideoByID(videos[videoIndex - 1].id)
+ .then(function (video) {
+ // // can be uncommented if you don't want the bot to play live streams
+ // if (video.raw.snippet.liveBroadcastContent === 'live') {
+ // songEmbed.delete();
+ // return msg.say("I don't support live streams!");
+ // }
+
+ // // can be uncommented if you don't want the bot to play videos longer than 1 hour
+ // if (video.duration.hours !== 0) {
+ // songEmbed.delete();
+ // return msg.say('I cannot play videos longer than 1 hour');
+ // }
+
+ // // can be uncommented if you don't want to limit the queue
+ // if (msg.guild.musicData.queue.length > 10) {
+ // songEmbed.delete();
+ // return msg.say(
+ // 'There are too many songs in the queue already, skip or wait a bit'
+ // );
+ // }
+ msg.guild.musicData.queue.push(
+ that.constructSongObj(video, voiceChannel)
+ );
+ if (msg.guild.musicData.isPlaying == false) {
+ msg.guild.musicData.isPlaying = true;
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ that.playSong(msg.guild.musicData.queue, msg);
+ } else if (msg.guild.musicData.isPlaying == true) {
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ return msg.say(`${video.title} added to queue ` + emoji.random());
+ }
+ })
+ .catch(function () {
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ return msg.say(
+ 'an error has occured when trying to get the video id from youtube ' + emoji.random()
+ );
+ });
+ });
+ }
+ playSong(queue, msg) {
+ const classThis = this; // use classThis instead of 'this' because of lexical scope below
+ queue[0].voiceChannel
+ .join()
+ .then(function (connection) {
+ const dispatcher = connection
+ .play(
+ ytdl(queue[0].url, {
+ quality: 'highestaudio',
+ highWaterMark: 1024 * 1024 * 10
+ })
+ )
+ .on('start', function () {
+ msg.guild.musicData.songDispatcher = dispatcher;
+ const volume = 10 / 100;
+ msg.guild.musicData.volume = volume;
+ dispatcher.setVolume(msg.guild.musicData.volume);
+ const videoEmbed = new MessageEmbed()
+ .setThumbnail(queue[0].thumbnail)
+ .setColor(0xF97DAE)
+ .addField('now playing:', queue[0].title)
+ .addField('duration:', queue[0].duration);
+ if (queue[1]) videoEmbed.addField('next song:', queue[1].title);
+ msg.say(videoEmbed);
+ msg.guild.musicData.nowPlaying = queue[0];
+ return queue.shift();
+ })
+ .on('finish', function () {
+ if (queue.length >= 1) {
+ return classThis.playSong(queue, msg);
+ } else {
+ msg.guild.musicData.isPlaying = false;
+ msg.guild.musicData.nowPlaying = null;
+ msg.guild.musicData.songDispatcher = null;
+ return msg.guild.me.voice.channel.leave();
+ }
+ })
+ .on('error', function (e) {
+ msg.say('can\'t play song ' + emoji.random());
+ console.error(e);
+ msg.guild.musicData.queue.length = 0;
+ msg.guild.musicData.isPlaying = false;
+ msg.guild.musicData.nowPlaying = null;
+ msg.guild.musicData.songDispatcher = null;
+ return msg.guild.me.voice.channel.leave();
+ });
+ })
+ .catch(function (e) {
+ console.error(e);
+ return msg.guild.me.voice.channel.leave();
+ });
+ }
+ constructSongObj(video, voiceChannel) {
+ let duration = this.formatDuration(video.duration);
+ if (duration == '00:00') duration = 'live stream';
+ return {
+ url: `https://www.youtube.com/watch?v=${video.raw.id}`,
+ title: video.title,
+ duration,
+ thumbnail: video.thumbnails.high.url,
+ voiceChannel
+ };
+ }
+ // prettier-ignore
+ formatDuration(durationObj) {
+ const duration = `${durationObj.hours ? (durationObj.hours + ':') : ''}${
+ durationObj.minutes ? durationObj.minutes : '00'
+ }:${
+ (durationObj.seconds < 10)
+ ? ('0' + durationObj.seconds)
+ : (durationObj.seconds
+ ? durationObj.seconds
+ : '00')
+ }`;
+ return duration;
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/fart.js b/src/commands/voice/fart.js
new file mode 100644
index 0000000..394a2d5
--- /dev/null
+++ b/src/commands/voice/fart.js
@@ -0,0 +1,209 @@
+// TODO: shits broken bc i cant get variables from different scopes
+/*
+const ytdl = require('ytdl-core');
+const { Command } = require('discord.js-commando');
+const { MessageEmbed } = require('discord.js');
+const Youtube = require('simple-youtube-api');
+//const { youtubeAPI } = require('../../config.json');
+const youtube = new Youtube('AIzaSyB9xJENORzZt-GmOGx4WsNCPgKSIxhJcds');
+const emoji = require('emoji-random');
+
+module.exports = class FartVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'fart',
+ group: 'voice',
+ memberName: 'fart',
+ description: 'gives you a random fart',
+ guildOnly: true,
+ clientPermissions: ['SPEAK', 'CONNECT'],
+ examples: ['s5n!fart']
+ });
+ }
+ async run(msg) {
+ var fartNum = Math.floor((Math.random() * 8) + 1);
+ if (fartNum == 1) {
+ var fartMsg = 'you got fart 1, courtesy of sin ' + emoji.random();
+ var fartTitle = 'fart 1';
+ var fartAudio = '../../assets/audio/farts/1.mp3';
+ } else if (fartNum == 2) {
+ var fartMsg = 'you got fart 2, courtesy of sin ' + emoji.random();
+ var fartTitle = 'fart 2';
+ var fartAudio = '../../assets/audio/farts/2.mp3';
+ } else if (fartNum == 3) {
+ var fartMsg = 'you got fart 3, courtesy of sin ' + emoji.random();
+ var fartTitle = 'fart 3';
+ var fartAudio = '../../assets/audio/farts/3.mp3';
+ } else if (fartNum == 4) {
+ var fartMsg = 'you got fart 4, courtesy of sin ' + emoji.random();
+ var fartTitle = 'fart 4';
+ var fartAudio = '../../assets/audio/farts/4.mp3';
+ } else if (fartNum == 5) {
+ var fartMsg = 'you got fart 5, courtesy of sin ' + emoji.random();
+ var fartTitle = 'fart 5';
+ var fartAudio = '../../assets/audio/farts/5.mp3';
+ } else if (fartNum == 6) {
+ var fartMsg = 'you got fart 6, courtesy of nick ' + emoji.random();
+ var fartTitle = 'fart 6';
+ var fartAudio = '../../assets/audio/farts/6.mp3';
+ } else if (fartNum == 7) {
+ var fartMsg = 'you got fart 7, courtesy of nick ' + emoji.random();
+ var fartTitle = 'fart 7';
+ var fartAudio = '../../assets/audio/farts/7.mp3';
+ } else if (fartNum == 8) {
+ var fartMsg = 'you got fart 8, courtesy of nick ' + emoji.random();
+ var fartTitle = 'fart 8';
+ var fartAudio = '../../assets/audio/farts/8.mp3';
+ }
+
+ const voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.say('join a channel and try again ' + emoji.random());
+
+ const video = await fartAudio;
+ // // can be uncommented if you don't want the bot to play live streams
+ // if (video.raw.snippet.liveBroadcastContent === 'live') {
+ // return msg.say("I don't support live streams!");
+ // }
+ // // can be uncommented if you don't want the bot to play videos longer than 1 hour
+ // if (video.duration.hours !== 0) {
+ // return msg.say('I cannot play videos longer than 1 hour');
+ // }
+ // // can be uncommented if you want to limit the queue
+ // if (msg.guild.musicData.queue.length > 10) {
+ // return msg.say(
+ // 'There are too many songs in the queue already, skip or wait a bit'
+ // );
+ // }
+ msg.guild.musicData.queue.push(
+ this.constructSongObj(video, voiceChannel)
+ );
+ if (
+ msg.guild.musicData.isPlaying == false ||
+ typeof msg.guild.musicData.isPlaying == 'undefined'
+ ) {
+ msg.guild.musicData.isPlaying = true;
+ return this.playSong(msg.guild.musicData.queue, msg);
+ } else if (msg.guild.musicData.isPlaying == true) {
+ msg.reply(fartMsg);
+ msg.say(fartTitle, 'added to queue ' + emoji.random());
+ return
+ }
+
+ var that = this;
+ msg.channel
+ .awaitMessages(
+ function (msg) {
+ return (msg.content > 0 && msg.content < 6) || msg.content === 'exit';
+ }, {
+ max: 1,
+ time: 60000,
+ errors: ['time']
+ }
+ )
+ .then(function (response) {
+ const videoIndex = parseInt(response.first().content);
+ if (response.first().content === 'exit') return songEmbed.delete();
+ youtube
+ .then(function (video) {
+ // // can be uncommented if you don't want the bot to play live streams
+ // if (video.raw.snippet.liveBroadcastContent === 'live') {
+ // songEmbed.delete();
+ // return msg.say("I don't support live streams!");
+ // }
+
+ // // can be uncommented if you don't want the bot to play videos longer than 1 hour
+ // if (video.duration.hours !== 0) {
+ // songEmbed.delete();
+ // return msg.say('I cannot play videos longer than 1 hour');
+ // }
+
+ // // can be uncommented if you don't want to limit the queue
+ // if (msg.guild.musicData.queue.length > 10) {
+ // songEmbed.delete();
+ // return msg.say(
+ // 'There are too many songs in the queue already, skip or wait a bit'
+ // );
+ // }
+ msg.guild.musicData.queue.push(
+ that.constructSongObj(video, voiceChannel)
+ );
+ if (msg.guild.musicData.isPlaying == false) {
+ msg.guild.musicData.isPlaying = true;
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ that.playSong(msg.guild.musicData.queue, msg);
+ } else if (msg.guild.musicData.isPlaying == true) {
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ return msg.say(fartTitle, 'added to queue ' + emoji.random());
+ }
+ })
+ .catch(function () {
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ return msg.say(
+ 'an error has occured when trying to get the video file ' + emoji.random()
+ );
+ });
+ });
+ }
+ playSong(queue, msg) {
+ const classThis = this; // use classThis instead of 'this' because of lexical scope below
+ queue[0].voiceChannel
+ .join()
+ .then(function (connection) {
+ const dispatcher = connection
+ .play(
+ fartAudio // TODO: broken here
+ )
+ .on('start', function () {
+ msg.guild.musicData.songDispatcher = dispatcher;
+ const volume = 100 / 100;
+ msg.guild.musicData.volume = volume;
+ dispatcher.setVolume(msg.guild.musicData.volume);
+ const videoEmbed = new MessageEmbed()
+ .setThumbnail(queue[0].thumbnail)
+ .setColor(0xF97DAE)
+ .addField('now playing:', queue[0].title)
+ .addField('duration:', queue[0].duration);
+ if (queue[1]) videoEmbed.addField('next song:', queue[1].title);
+ msg.say(videoEmbed);
+ msg.guild.musicData.nowPlaying = queue[0];
+ return queue.shift();
+ })
+ .on('finish', function () {
+ if (queue.length >= 1) {
+ return classThis.playSong(queue, msg);
+ } else {
+ msg.guild.musicData.isPlaying = false;
+ msg.guild.musicData.nowPlaying = null;
+ msg.guild.musicData.songDispatcher = null;
+ return msg.guild.me.voice.channel.leave();
+ }
+ })
+ .on('error', function (e) {
+ msg.say('can\'t play song ' + emoji.random());
+ console.error(e);
+ msg.guild.musicData.queue.length = 0;
+ msg.guild.musicData.isPlaying = false;
+ msg.guild.musicData.nowPlaying = null;
+ msg.guild.musicData.songDispatcher = null;
+ return msg.guild.me.voice.channel.leave();
+ });
+ })
+ .catch(function (e) {
+ console.error(e);
+ return msg.guild.me.voice.channel.leave();
+ });
+ }
+ constructSongObj(video, voiceChannel) {
+ return { // TODO: and broken here
+ url: 'fart',
+ title: 'fart 1',
+ voiceChannel
+ };
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/itemshop.js b/src/commands/voice/itemshop.js
new file mode 100644
index 0000000..730ce83
--- /dev/null
+++ b/src/commands/voice/itemshop.js
@@ -0,0 +1,211 @@
+const ytdl = require('ytdl-core');
+const { Command } = require('discord.js-commando');
+const { MessageEmbed } = require('discord.js');
+const Youtube = require('simple-youtube-api');
+//const { youtubeAPI } = require('../../config.json');
+const youtube = new Youtube('AIzaSyB9xJENORzZt-GmOGx4WsNCPgKSIxhJcds');
+const emoji = require('emoji-random');
+
+module.exports = class ABeeVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'itemshop',
+ aliases: ['item-shop'],
+ group: 'voice',
+ memberName: 'itemshop',
+ description: 'use code frozen in the itemshop',
+ guildOnly: true,
+ clientPermissions: ['SPEAK', 'CONNECT'],
+ examples: ['s5n!itemshop', 's5n!item-shop']
+ });
+ }
+ async run(msg) {
+ const voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.say('join a channel and try again ' + emoji.random());
+
+ const id = 'pBiI1hTwU7E';
+ const video = await youtube.getVideoByID(id).catch(function () {
+ return msg.say(
+ 'there was a problem getting the video you provided ' + emoji.random()
+ );
+ });
+ // // can be uncommented if you don't want the bot to play live streams
+ // if (video.raw.snippet.liveBroadcastContent === 'live') {
+ // return msg.say("I don't support live streams!");
+ // }
+ // // can be uncommented if you don't want the bot to play videos longer than 1 hour
+ // if (video.duration.hours !== 0) {
+ // return msg.say('I cannot play videos longer than 1 hour');
+ // }
+ // // can be uncommented if you want to limit the queue
+ // if (msg.guild.musicData.queue.length > 10) {
+ // return msg.say(
+ // 'There are too many songs in the queue already, skip or wait a bit'
+ // );
+ // }
+ msg.guild.musicData.queue.push(
+ this.constructSongObj(video, voiceChannel)
+ );
+ if (
+ msg.guild.musicData.isPlaying == false ||
+ typeof msg.guild.musicData.isPlaying == 'undefined'
+ ) {
+ msg.guild.musicData.isPlaying = true;
+ return this.playSong(msg.guild.musicData.queue, msg);
+ } else if (msg.guild.musicData.isPlaying == true) {
+ msg.reply('USE CODE FROZEN IN THE FORTNITE ITEM SHOP!!! ' + emoji.random());
+ msg.say(`${video.title} added to queue ` + emoji.random());
+ return;
+ }
+
+ var that = this;
+ msg.channel
+ .awaitMessages(
+ function (msg) {
+ return (msg.content > 0 && msg.content < 6) || msg.content === 'exit';
+ }, {
+ max: 1,
+ time: 60000,
+ errors: ['time']
+ }
+ )
+ .then(function (response) {
+ const videoIndex = parseInt(response.first().content);
+ if (response.first().content === 'exit') return songEmbed.delete();
+ youtube
+ .getVideoByID(videos[videoIndex - 1].id)
+ .then(function (video) {
+ // // can be uncommented if you don't want the bot to play live streams
+ // if (video.raw.snippet.liveBroadcastContent === 'live') {
+ // songEmbed.delete();
+ // return msg.say("I don't support live streams!");
+ // }
+
+ // // can be uncommented if you don't want the bot to play videos longer than 1 hour
+ // if (video.duration.hours !== 0) {
+ // songEmbed.delete();
+ // return msg.say('I cannot play videos longer than 1 hour');
+ // }
+
+ // // can be uncommented if you don't want to limit the queue
+ // if (msg.guild.musicData.queue.length > 10) {
+ // songEmbed.delete();
+ // return msg.say(
+ // 'There are too many songs in the queue already, skip or wait a bit'
+ // );
+ // }
+ msg.guild.musicData.queue.push(
+ that.constructSongObj(video, voiceChannel)
+ );
+ if (msg.guild.musicData.isPlaying == false) {
+ msg.guild.musicData.isPlaying = true;
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ that.playSong(msg.guild.musicData.queue, msg);
+ } else if (msg.guild.musicData.isPlaying == true) {
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ msg.reply('USE CODE FROZEN IN THE FORTNITE ITEM SHOP!!! ' + emoji.random());
+ msg.say(`${video.title} added to queue`);
+ return;
+ }
+ })
+ .catch(function () {
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ return msg.say(
+ 'an error has occured when trying to get the video id from youtube'
+ );
+ });
+ });
+ }
+ playSong(queue, msg) {
+ const classThis = this; // use classThis instead of 'this' because of lexical scope below
+ queue[0].voiceChannel
+ .join()
+ .then(function (connection) {
+ const dispatcher = connection
+ .play(
+ ytdl(queue[0].url, {
+ quality: 'highestaudio',
+ highWaterMark: 1024 * 1024 * 10
+ })
+
+ )
+ .on('start', function () {
+ msg.guild.musicData.songDispatcher = dispatcher;
+ const volume = 10 / 100;
+ msg.guild.musicData.volume = volume;
+ dispatcher.setVolume(msg.guild.musicData.volume);
+ const videoEmbed = new MessageEmbed()
+ .setThumbnail(queue[0].thumbnail)
+ .setColor(0xF97DAE)
+ .addField('now playing:', queue[0].title)
+ .addField('duration:', queue[0].duration);
+ if (queue[1]) videoEmbed.addField('next song:', queue[1].title);
+ msg.say(videoEmbed);
+ msg.reply('use code frozen in the itemshop : 3 ' + emoji.random());
+ msg.guild.musicData.nowPlaying = queue[0];
+ return queue.shift();
+ })
+ .on('finish', function () {
+ if (queue.length >= 1) {
+ return classThis.playSong(queue, msg);
+ } else {
+ msg.guild.musicData.isPlaying = false;
+ msg.guild.musicData.nowPlaying = null;
+ msg.guild.musicData.songDispatcher = null;
+ return msg.guild.me.voice.channel.leave();
+ }
+ })
+ .on('error', function (e) {
+ msg.say('can\'t play song');
+ console.error(e);
+ msg.guild.musicData.queue.length = 0;
+ msg.guild.musicData.isPlaying = false;
+ msg.guild.musicData.nowPlaying = null;
+ msg.guild.musicData.songDispatcher = null;
+ return msg.guild.me.voice.channel.leave();
+ });
+ function timeCheck() {
+ if (dispatcher.streamTime >= 6000) {
+ msg.guild.musicData.isPlaying = false;
+ msg.guild.musicData.nowPlaying = null;
+ msg.guild.musicData.songDispatcher = null;
+ }
+ }
+ setInterval(timeCheck, 500);
+ })
+ .catch(function (e) {
+ console.error(e);
+ return msg.guild.me.voice.channel.leave();
+ });
+ }
+ constructSongObj(video, voiceChannel) {
+ let duration = this.formatDuration(video.duration);
+ if (duration == '00:00') duration = 'live stream';
+ return {
+ url: `https://www.youtube.com/watch?v=${video.raw.id}`,
+ title: video.title,
+ duration,
+ thumbnail: video.thumbnails.high.url,
+ voiceChannel
+ };
+ }
+ // prettier-ignore
+ formatDuration(durationObj) {
+ const duration = `${durationObj.hours ? (durationObj.hours + ':') : ''}${
+ durationObj.minutes ? durationObj.minutes : '00'
+ }:${
+ (durationObj.seconds < 10)
+ ? ('0' + durationObj.seconds)
+ : (durationObj.seconds
+ ? durationObj.seconds
+ : '00')
+ }`;
+ return duration;
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/join.js b/src/commands/voice/join.js
new file mode 100644
index 0000000..fda2516
--- /dev/null
+++ b/src/commands/voice/join.js
@@ -0,0 +1,29 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class JoinVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'join',
+ group: 'voice',
+ memberName: 'join',
+ description: 'joins your voice channel',
+ throttling: {
+ usages: 2,
+ duration: 5
+ },
+ guildOnly: true,
+ examples: ['s5n!join']
+ });
+ }
+ run(msg) {
+ if (msg.guild.musicData.isPlaying == false && msg.member.voice.channel) {
+ msg.member.voice.channel.join();
+ msg.reply('succesfully joined voice channel ' + emoji.random());
+ } else if (msg.guild.musicData.isPlaying == false) {
+ msg.reply('i\'m already in voice channel ' + emoji.random());
+ } else if (!msg.member.voice.channel) {
+ msg.reply('you\'re not in a voice channel ' + emoji.random());
+ }
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/leave.js b/src/commands/voice/leave.js
new file mode 100644
index 0000000..51456a6
--- /dev/null
+++ b/src/commands/voice/leave.js
@@ -0,0 +1,32 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class LeaveVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'leave',
+ aliases: ['end', 'stop'],
+ group: 'voice',
+ memberName: 'leave',
+ description: 'stops voice channel if any playing',
+ guildOnly: true,
+ examples: ['s5n!leave', 's5n!end', 's5n!stop']
+ });
+ }
+ run(msg) {
+ var voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.reply('join a channel and try again ' + emoji.random());
+
+ if (
+ typeof msg.guild.musicData.songDispatcher == 'undefined' ||
+ msg.guild.musicData.songDispatcher == null
+ ) {
+ return msg.reply('there isn\'t a song playing right now lol ' + emoji.random());
+ }
+ if (!msg.guild.musicData.queue)
+ return msg.say('there are no songs in queue rn lol ' + emoji.random());
+ msg.guild.musicData.songDispatcher.end();
+ msg.guild.musicData.queue.length = 0;
+ return;
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/loop.js b/src/commands/voice/loop.js
new file mode 100644
index 0000000..3679b4f
--- /dev/null
+++ b/src/commands/voice/loop.js
@@ -0,0 +1,32 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class LoopVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'loop',
+ aliases: ['repeat'],
+ group: 'voice',
+ memberName: 'loop',
+ description: 'loops currently playing audio',
+ guildOnly: true,
+ examples: ['s5n!loop', 's5n!repeat']
+ });
+ }
+ run(msg) {
+ var voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.reply('join a channel and try again ' + emoji.random());
+
+ if (
+ typeof msg.guild.musicData.songDispatcher == 'undefined' ||
+ msg.guild.musicData.songDispatcher == null
+ ) {
+ return msg.reply('there isn\'t a song playing right now lol ' + emoji.random());
+ }
+ msg.channel.send(
+ `${msg.guild.musicData.nowPlaying.title} added to queue ` + emoji.random()
+ );
+ msg.guild.musicData.queue.unshift(msg.guild.musicData.nowPlaying);
+ return;
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/moan.js b/src/commands/voice/moan.js
new file mode 100644
index 0000000..03824e3
--- /dev/null
+++ b/src/commands/voice/moan.js
@@ -0,0 +1,30 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class MoanVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'moan',
+ aliases: ['uhhhh'],
+ group: 'voice',
+ memberName: 'moan',
+ description: 'uhhhh',
+ guildOnly: true,
+ examples: ['s5n!moan', 's5n!uhhhh']
+ });
+ }
+ async run(msg) {
+ if (msg.member.voice.channel && !msg.guild.voice) {
+ const connection = await msg.member.voice.channel.join();
+ const dispatcher = connection.play('./assets/audio/uhhhh.wav');
+
+ dispatcher.on('finish', () => {
+ connection.disconnect();
+ });
+ } else if (msg.guild.voice) {
+ msg.reply('i\'m already playing that lol ' + emoji.random());
+ } else {
+ msg.reply('you need to join a voice channel first silly ' + emoji.random());
+ }
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/pause.js b/src/commands/voice/pause.js
new file mode 100644
index 0000000..f24d1ef
--- /dev/null
+++ b/src/commands/voice/pause.js
@@ -0,0 +1,30 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class PauseVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'pause',
+ group: 'voice',
+ memberName: 'pause',
+ description: 'pauses music if there is any playing',
+ guildOnly: true,
+ examples: ['s5n!pause']
+ });
+ }
+ run(msg) {
+ var voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.reply('join a channel and try again ' + emoji.random());
+
+ if (
+ typeof msg.guild.musicData.songDispatcher == 'undefined' ||
+ msg.guild.musicData.songDispatcher == null
+ ) {
+ return msg.reply('there isn\'t a song playing right now lol ' + emoji.random());
+ }
+
+ msg.say('song paused :pause_button:');
+
+ msg.guild.musicData.songDispatcher.pause();
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/play.js b/src/commands/voice/play.js
new file mode 100644
index 0000000..bf59268
--- /dev/null
+++ b/src/commands/voice/play.js
@@ -0,0 +1,290 @@
+const ytdl = require('ytdl-core');
+const { Command } = require('discord.js-commando');
+const { MessageEmbed } = require('discord.js');
+const Youtube = require('simple-youtube-api');
+const { youtubeAPI } = require('../../config.json');
+const youtube = new Youtube('AIzaSyB9xJENORzZt-GmOGx4WsNCPgKSIxhJcds');
+const emoji = require('emoji-random');
+
+module.exports = class PlayVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'play',
+ group: 'voice',
+ memberName: 'play',
+ description: 'play a youtube video',
+ guildOnly: true,
+ clientPermissions: ['SPEAK', 'CONNECT'],
+ args: [
+ {
+ key: 'query',
+ prompt: 'what song u wanna hear?',
+ type: 'string',
+ validate: function (query) {
+ return query.length > 0 && query.length < 200;
+ }
+ }
+ ],
+ examples: [
+ 's5n!play https://www.youtube.com/watch?v=dQw4w9WgXcQ',
+ 's5n!play despacito'
+ ]
+ });
+ }
+ async run(msg, { query }) {
+ const voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.say('join a channel and try again ' + emoji.random());
+
+ if (
+ // if the user entered yt playlist url
+ query.match(
+ /^(?!.*\?.*\bv=)https:\/\/www\.youtube\.com\/.*\?.*\blist=.*$/
+ )
+ ) {
+ const playlist = await youtube.getPlaylist(query).catch(function () {
+ return msg.say('playlist is either private or it does not exist ' + emoji.random());
+ });
+ // remove the 10 if you removed the queue limit conditions below
+ const videosObj = await playlist.getVideos(10).catch(function () {
+ return msg.say(
+ 'there was a problem getting one of the videos in the playlist ' + emoji.random()
+ );
+ });
+ for (let i = 0; i < videosObj.length; i++) {
+ const video = await videosObj[i].fetch();
+ // this can be uncommented if you choose to limit the queue
+ // if (msg.guild.musicData.queue.length < 10) {
+ //
+ msg.guild.musicData.queue.push(
+ this.constructSongObj(video, voiceChannel)
+ );
+ // } else {
+ // return msg.say(
+ // `I can't play the full playlist because there will be more than 10 songs in queue`
+ // );
+ // }
+ }
+ if (msg.guild.musicData.isPlaying == false) {
+ msg.guild.musicData.isPlaying = true;
+ return this.playSong(msg.guild.musicData.queue, msg);
+ } else if (msg.guild.musicData.isPlaying == true) {
+ return msg.say(
+ `playlist - :musical_note: ${playlist.title} :musical_note: has been added to queue ` + emoji.random()
+ );
+ }
+ }
+
+ // This if statement checks if the user entered a youtube url, it can be any kind of youtube url
+ if (query.match(/^(http(s)?:\/\/)?((w){3}.)?youtu(be|.be)?(\.com)?\/.+/)) {
+ query = query
+ .replace(/(>|<)/gi, '')
+ .split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
+ const id = query[2].split(/[^0-9a-z_\-]/i)[0];
+ const video = await youtube.getVideoByID(id).catch(function () {
+ return msg.say(
+ 'there was a problem getting the video you provided ' + emoji.random()
+ );
+ });
+ // // can be uncommented if you don't want the bot to play live streams
+ // if (video.raw.snippet.liveBroadcastContent === 'live') {
+ // return msg.say("I don't support live streams!");
+ // }
+ // // can be uncommented if you don't want the bot to play videos longer than 1 hour
+ // if (video.duration.hours !== 0) {
+ // return msg.say('I cannot play videos longer than 1 hour');
+ // }
+ // // can be uncommented if you want to limit the queue
+ // if (msg.guild.musicData.queue.length > 10) {
+ // return msg.say(
+ // 'There are too many songs in the queue already, skip or wait a bit'
+ // );
+ // }
+ msg.guild.musicData.queue.push(
+ this.constructSongObj(video, voiceChannel)
+ );
+ if (
+ msg.guild.musicData.isPlaying == false ||
+ typeof msg.guild.musicData.isPlaying == 'undefined'
+ ) {
+ msg.guild.musicData.isPlaying = true;
+ return this.playSong(msg.guild.musicData.queue, msg);
+ } else if (msg.guild.musicData.isPlaying == true) {
+ return msg.say(`${video.title} added to queue ` + emoji.random());
+ }
+ }
+
+ // if user provided a song/video name
+ const videos = await youtube.searchVideos(query, 5).catch(function () {
+ return msg.say(
+ 'there was a problem searching the video you requested :( ' + emoji.random()
+ );
+ });
+ if (videos.length < 5) {
+ return msg.say(
+ `i had some trouble finding what you were looking for, please try again or be more specific lol ` + emoji.random()
+ );
+ }
+ const vidNameArr = [];
+ for (let i = 0; i < videos.length; i++) {
+ vidNameArr.push(`${i + 1}: ${videos[i].title}`);
+ }
+ vidNameArr.push('exit');
+ const embed = new MessageEmbed()
+ .setColor(0xF97DAE)
+ .setTitle('choose a song by msging a number between 1 and 5 ' + emoji.random())
+ .addField(`‎`, '**song #**' + vidNameArr[0])
+ .addField(`‎`, '**song #**' + vidNameArr[1])
+ .addField(`‎`, '**song #**' + vidNameArr[2])
+ .addField(`‎`, '**song #**' + vidNameArr[3])
+ .addField(`‎`, '**song #**' + vidNameArr[4])
+ .addField(`‎`, '**exit selection**: ' + 'exit');
+ var songEmbed = await msg.channel.send({
+ embed
+ });
+ var that = this;
+ msg.channel
+ .awaitMessages(
+ function (msg) {
+ return (msg.content > 0 && msg.content < 6) || msg.content === 'exit';
+ }, {
+ max: 1,
+ time: 60000,
+ errors: ['time']
+ }
+ )
+ .then(function (response) {
+ const videoIndex = parseInt(response.first().content);
+ if (response.first().content === 'exit') return songEmbed.delete();
+ youtube
+ .getVideoByID(videos[videoIndex - 1].id)
+ .then(function (video) {
+ // // can be uncommented if you don't want the bot to play live streams
+ // if (video.raw.snippet.liveBroadcastContent === 'live') {
+ // songEmbed.delete();
+ // return msg.say("I don't support live streams!");
+ // }
+
+ // // can be uncommented if you don't want the bot to play videos longer than 1 hour
+ // if (video.duration.hours !== 0) {
+ // songEmbed.delete();
+ // return msg.say('I cannot play videos longer than 1 hour');
+ // }
+
+ // // can be uncommented if you don't want to limit the queue
+ // if (msg.guild.musicData.queue.length > 10) {
+ // songEmbed.delete();
+ // return msg.say(
+ // 'There are too many songs in the queue already, skip or wait a bit'
+ // );
+ // }
+ msg.guild.musicData.queue.push(
+ that.constructSongObj(video, voiceChannel)
+ );
+ if (msg.guild.musicData.isPlaying == false) {
+ msg.guild.musicData.isPlaying = true;
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ that.playSong(msg.guild.musicData.queue, msg);
+ } else if (msg.guild.musicData.isPlaying == true) {
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ return msg.say(`${video.title} added to queue ` + emoji.random());
+ }
+ })
+ .catch(function () {
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ return msg.say(
+ 'an error has occured when trying to get the video id from youtube ' + emoji.random()
+ );
+ });
+ })
+ .catch(function () {
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ return msg.say(
+ 'try again and enter a number between 1 and 5 or exit ' + emoji.random()
+ );
+ });
+ }
+ playSong(queue, msg) {
+ const classThis = this; // use classThis instead of 'this' because of lexical scope below
+ queue[0].voiceChannel
+ .join()
+ .then(function (connection) {
+ const dispatcher = connection
+ .play(
+ ytdl(queue[0].url, {
+ quality: 'highestaudio',
+ highWaterMark: 1024 * 1024 * 10
+ })
+ )
+ .on('start', function () {
+ msg.guild.musicData.songDispatcher = dispatcher;
+ const volume = 10 / 100;
+ msg.guild.musicData.volume = volume;
+ dispatcher.setVolume(msg.guild.musicData.volume);
+ const videoEmbed = new MessageEmbed()
+ .setThumbnail(queue[0].thumbnail)
+ .setColor(0xF97DAE)
+ .addField('now playing:', queue[0].title)
+ .addField('duration:', queue[0].duration);
+ if (queue[1]) videoEmbed.addField('next song:', queue[1].title);
+ msg.say(videoEmbed);
+ msg.guild.musicData.nowPlaying = queue[0];
+ return queue.shift();
+ })
+ .on('finish', function () {
+ if (queue.length >= 1) {
+ return classThis.playSong(queue, msg);
+ } else {
+ msg.guild.musicData.isPlaying = false;
+ msg.guild.musicData.nowPlaying = null;
+ msg.guild.musicData.songDispatcher = null;
+ return msg.guild.me.voice.channel.leave();
+ }
+ })
+ .on('error', function (e) {
+ msg.say('can\'t play song ' + emoji.random());
+ console.error(e);
+ msg.guild.musicData.queue.length = 0;
+ msg.guild.musicData.isPlaying = false;
+ msg.guild.musicData.nowPlaying = null;
+ msg.guild.musicData.songDispatcher = null;
+ return msg.guild.me.voice.channel.leave();
+ });
+ })
+ .catch(function (e) {
+ console.error(e);
+ return msg.guild.me.voice.channel.leave();
+ });
+ }
+ constructSongObj(video, voiceChannel) {
+ let duration = this.formatDuration(video.duration);
+ if (duration == '00:00') duration = 'live stream';
+ return {
+ url: `https://www.youtube.com/watch?v=${video.raw.id}`,
+ title: video.title,
+ duration,
+ thumbnail: video.thumbnails.high.url,
+ voiceChannel
+ };
+ }
+ // prettier-ignore
+ formatDuration(durationObj) {
+ const duration = `${durationObj.hours ? (durationObj.hours + ':') : ''}${
+ durationObj.minutes ? durationObj.minutes : '00'
+ }:${
+ (durationObj.seconds < 10)
+ ? ('0' + durationObj.seconds)
+ : (durationObj.seconds
+ ? durationObj.seconds
+ : '00')
+ }`;
+ return duration;
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/psycho.js b/src/commands/voice/psycho.js
new file mode 100644
index 0000000..ba45254
--- /dev/null
+++ b/src/commands/voice/psycho.js
@@ -0,0 +1,196 @@
+const ytdl = require('ytdl-core');
+const { Command } = require('discord.js-commando');
+const { MessageEmbed } = require('discord.js');
+const Youtube = require('simple-youtube-api');
+const { youtubeAPI } = require('../../config.json');
+const youtube = new Youtube('AIzaSyB9xJENORzZt-GmOGx4WsNCPgKSIxhJcds');
+const emoji = require('emoji-random');
+
+module.exports = class PsychoVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'psycho',
+ group: 'voice',
+ memberName: 'psycho',
+ description: 'plays the psycho by mase',
+ guildOnly: true,
+ clientPermissions: ['SPEAK', 'CONNECT'],
+ examples: ['s5n!psycho']
+ });
+ }
+ async run(msg, { query }) {
+ const voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.say('join a channel and try again ' + emoji.random());
+
+ const id = 'fnd_HSmAODs';
+ const video = await youtube.getVideoByID(id).catch(function () {
+ return msg.say(
+ 'there was a problem getting the video you provided ' + emoji.random()
+ );
+ });
+ // // can be uncommented if you don't want the bot to play live streams
+ // if (video.raw.snippet.liveBroadcastContent === 'live') {
+ // return msg.say("I don't support live streams!");
+ // }
+ // // can be uncommented if you don't want the bot to play videos longer than 1 hour
+ // if (video.duration.hours !== 0) {
+ // return msg.say('I cannot play videos longer than 1 hour');
+ // }
+ // // can be uncommented if you want to limit the queue
+ // if (msg.guild.musicData.queue.length > 10) {
+ // return msg.say(
+ // 'There are too many songs in the queue already, skip or wait a bit'
+ // );
+ // }
+ msg.guild.musicData.queue.push(
+ this.constructSongObj(video, voiceChannel)
+ );
+ if (
+ msg.guild.musicData.isPlaying == false ||
+ typeof msg.guild.musicData.isPlaying == 'undefined'
+ ) {
+ msg.guild.musicData.isPlaying = true;
+ return this.playSong(msg.guild.musicData.queue, msg);
+ } else if (msg.guild.musicData.isPlaying == true) {
+ return msg.say(`${video.title} added to queue ` + emoji.random());
+ }
+
+ var that = this;
+ msg.channel
+ .awaitMessages(
+ function (msg) {
+ return (msg.content > 0 && msg.content < 6) || msg.content === 'exit';
+ }, {
+ max: 1,
+ time: 60000,
+ errors: ['time']
+ }
+ )
+ .then(function (response) {
+ const videoIndex = parseInt(response.first().content);
+ if (response.first().content === 'exit') return songEmbed.delete();
+ youtube
+ .getVideoByID(videos[videoIndex - 1].id)
+ .then(function (video) {
+ // // can be uncommented if you don't want the bot to play live streams
+ // if (video.raw.snippet.liveBroadcastContent === 'live') {
+ // songEmbed.delete();
+ // return msg.say("I don't support live streams!");
+ // }
+
+ // // can be uncommented if you don't want the bot to play videos longer than 1 hour
+ // if (video.duration.hours !== 0) {
+ // songEmbed.delete();
+ // return msg.say('I cannot play videos longer than 1 hour');
+ // }
+
+ // // can be uncommented if you don't want to limit the queue
+ // if (msg.guild.musicData.queue.length > 10) {
+ // songEmbed.delete();
+ // return msg.say(
+ // 'There are too many songs in the queue already, skip or wait a bit'
+ // );
+ // }
+ msg.guild.musicData.queue.push(
+ that.constructSongObj(video, voiceChannel)
+ );
+ if (msg.guild.musicData.isPlaying == false) {
+ msg.guild.musicData.isPlaying = true;
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ that.playSong(msg.guild.musicData.queue, msg);
+ } else if (msg.guild.musicData.isPlaying == true) {
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ return msg.say(`${video.title} added to queue ` + emoji.random());
+ }
+ })
+ .catch(function () {
+ if (songEmbed) {
+ songEmbed.delete();
+ }
+ return msg.say(
+ 'an error has occured when trying to get the video id from youtube ' + emoji.random()
+ );
+ });
+ });
+ }
+ playSong(queue, msg) {
+ const classThis = this; // use classThis instead of 'this' because of lexical scope below
+ queue[0].voiceChannel
+ .join()
+ .then(function (connection) {
+ const dispatcher = connection
+ .play(
+ ytdl(queue[0].url, {
+ quality: 'highestaudio',
+ highWaterMark: 1024 * 1024 * 10
+ })
+ )
+ .on('start', function () {
+ msg.guild.musicData.songDispatcher = dispatcher;
+ const volume = 10 / 100;
+ msg.guild.musicData.volume = volume;
+ dispatcher.setVolume(msg.guild.musicData.volume);
+ const videoEmbed = new MessageEmbed()
+ .setThumbnail(queue[0].thumbnail)
+ .setColor(0xF97DAE)
+ .addField('now playing:', queue[0].title)
+ .addField('duration:', queue[0].duration);
+ if (queue[1]) videoEmbed.addField('next song:', queue[1].title);
+ msg.say(videoEmbed);
+ msg.guild.musicData.nowPlaying = queue[0];
+ return queue.shift();
+ })
+ .on('finish', function () {
+ if (queue.length >= 1) {
+ return classThis.playSong(queue, msg);
+ } else {
+ msg.guild.musicData.isPlaying = false;
+ msg.guild.musicData.nowPlaying = null;
+ msg.guild.musicData.songDispatcher = null;
+ return msg.guild.me.voice.channel.leave();
+ }
+ })
+ .on('error', function (e) {
+ msg.say('can\'t play song ' + emoji.random());
+ console.error(e);
+ msg.guild.musicData.queue.length = 0;
+ msg.guild.musicData.isPlaying = false;
+ msg.guild.musicData.nowPlaying = null;
+ msg.guild.musicData.songDispatcher = null;
+ return msg.guild.me.voice.channel.leave();
+ });
+ })
+ .catch(function (e) {
+ console.error(e);
+ return msg.guild.me.voice.channel.leave();
+ });
+ }
+ constructSongObj(video, voiceChannel) {
+ let duration = this.formatDuration(video.duration);
+ if (duration == '00:00') duration = 'live stream';
+ return {
+ url: `https://www.youtube.com/watch?v=${video.raw.id}`,
+ title: video.title,
+ duration,
+ thumbnail: video.thumbnails.high.url,
+ voiceChannel
+ };
+ }
+ // prettier-ignore
+ formatDuration(durationObj) {
+ const duration = `${durationObj.hours ? (durationObj.hours + ':') : ''}${
+ durationObj.minutes ? durationObj.minutes : '00'
+ }:${
+ (durationObj.seconds < 10)
+ ? ('0' + durationObj.seconds)
+ : (durationObj.seconds
+ ? durationObj.seconds
+ : '00')
+ }`;
+ return duration;
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/queue.js b/src/commands/voice/queue.js
new file mode 100644
index 0000000..d93de8b
--- /dev/null
+++ b/src/commands/voice/queue.js
@@ -0,0 +1,49 @@
+const { Command } = require('discord.js-commando');
+const { MessageEmbed } = require('discord.js');
+const emoji = require('emoji-random');
+
+module.exports = class QueueVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'queue',
+ aliases: [
+ 'q',
+ 'song-list',
+ 'next-songs',
+ 'songlist',
+ 'nextsongs',
+ 'nextsong',
+ 'next-song'
+ ],
+ group: 'voice',
+ memberName: 'queue',
+ description: 'display song queue',
+ guildOnly: true,
+ examples: [
+ 's5n!queue',
+ 's5n!q',
+ 's5n!songlist',
+ 's5n!song-list',
+ 's5n!nextsong',
+ 's5n!next-song',
+ 's5n!nextsongs',
+ 's5n!next-songs'
+ ]
+ });
+ }
+ run(msg) {
+ if (msg.guild.musicData.queue.length == 0)
+ return msg.say('there are no songs in the queue lol ' + emoji.random());
+ const titleArray = [];
+ msg.guild.musicData.queue.map(obj => {
+ titleArray.push(obj.title);
+ });
+ let queueEmbed = new MessageEmbed()
+ .setColor(0xF97DAE)
+ .setTitle('music queue ' + emoji.random());
+ for (let i = 0; i < titleArray.length; i++) {
+ queueEmbed.addField(`‎`, `**${i + 1}**: ` + `${titleArray[i]}`);
+ }
+ return msg.say(queueEmbed);
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/remove.js b/src/commands/voice/remove.js
new file mode 100644
index 0000000..a336ae4
--- /dev/null
+++ b/src/commands/voice/remove.js
@@ -0,0 +1,39 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class RemoveVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'remove',
+ group: 'voice',
+ memberName: 'remove',
+ description: 'removes a song from the queue',
+ guildOnly: true,
+ args: [
+ {
+ key: 'songNumber',
+ prompt: 'what song u want to remove from q?',
+ type: 'integer'
+ }
+ ],
+ examples: ['s5n!remove 2']
+ });
+ }
+ run(msg, { songNumber }) {
+ if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) {
+ return msg.reply('enter a valid song number lol ' + emoji.random());
+ }
+ var voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.reply('join a channel and try again lol ' + emoji.random());
+
+ if (
+ typeof msg.guild.musicData.songDispatcher == 'undefined' ||
+ msg.guild.musicData.songDispatcher == null
+ ) {
+ return msg.reply('no songs playing right now lol ' + emoji.random());
+ }
+
+ msg.guild.musicData.queue.splice(songNumber - 1, 1);
+ return msg.say(`removed song **#${songNumber}** from queue ` + emoji.random());
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/resume.js b/src/commands/voice/resume.js
new file mode 100644
index 0000000..dfd69f8
--- /dev/null
+++ b/src/commands/voice/resume.js
@@ -0,0 +1,30 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class ResumeVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'resume',
+ group: 'voice',
+ memberName: 'resume',
+ description: 'resumes music if there is any stopped',
+ guildOnly: true,
+ examples: ['s5n!resume']
+ });
+ }
+ run(msg) {
+ var voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.reply('join a channel and try again ') + emoji.random();
+
+ if (
+ typeof msg.guild.musicData.songDispatcher == 'undefined' ||
+ msg.guild.musicData.songDispatcher == null
+ ) {
+ return msg.reply('there isn\'t a song playing right now lol ' + emoji.random());
+ }
+
+ msg.say('song resumed :play_pause:');
+
+ msg.guild.musicData.songDispatcher.resume();
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/shuffle.js b/src/commands/voice/shuffle.js
new file mode 100644
index 0000000..3771f16
--- /dev/null
+++ b/src/commands/voice/shuffle.js
@@ -0,0 +1,51 @@
+const { Command } = require('discord.js-commando');
+const { MessageEmbed } = require('discord.js');
+const emoji = require('emoji-random');
+
+module.exports = class ShuffleVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'shuffle',
+ group: 'voice',
+ memberName: 'shuffle',
+ description: 'shuffle the queue',
+ guildOnly: true,
+ examples: ['s5n!shuffle']
+ });
+ }
+ run(msg) {
+ var voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.reply('join channel and try again k ' + emoji.random());
+
+ if (
+ typeof msg.guild.musicData.songDispatcher == 'undefined' ||
+ msg.guild.musicData.songDispatcher == null
+ ) {
+ return msg.reply('there is no song playing right now ' + emoji.random());
+ }
+
+ if (msg.guild.musicData.queue.length < 1)
+ return msg.say('There are no songs in queue ' + emoji.random());
+
+ shuffleQueue(msg.guild.musicData.queue);
+
+ const titleArray = [];
+ msg.guild.musicData.queue.map(obj => {
+ titleArray.push(obj.title);
+ });
+ var queueEmbed = new MessageEmbed()
+ .setColor(0xF97DAE)
+ .setTitle('new music q ' + emoji.random());
+ for (let i = 0; i < titleArray.length; i++) {
+ queueEmbed.addField(`${i + 1}:`, `${titleArray[i]}`);
+ }
+ return msg.say(queueEmbed);
+ }
+};
+
+function shuffleQueue(queue) {
+ for (let i = queue.length - 1; i > 0; i--) {
+ const j = Math.floor(Math.random() * (i + 1));
+ [queue[i], queue[j]] = [queue[j], queue[i]];
+ }
+} \ No newline at end of file
diff --git a/src/commands/voice/skip.js b/src/commands/voice/skip.js
new file mode 100644
index 0000000..1bd70cd
--- /dev/null
+++ b/src/commands/voice/skip.js
@@ -0,0 +1,27 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class SkipVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'skip',
+ group: 'voice',
+ memberName: 'skip',
+ description: 'skip 1 song ahead in the queue',
+ guildOnly: true,
+ examples: ['s5n!skip']
+ });
+ }
+ run(msg) {
+ const voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.reply('join a channel and try again ' + emoji.random());
+
+ if (
+ typeof msg.guild.musicData.songDispatcher == 'undefined' ||
+ msg.guild.musicData.songDispatcher == null
+ ) {
+ return msg.reply('no songs playing right now bruh ' + emoji.random());
+ }
+ msg.guild.musicData.songDispatcher.end();
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/skipall.js b/src/commands/voice/skipall.js
new file mode 100644
index 0000000..ad4f15e
--- /dev/null
+++ b/src/commands/voice/skipall.js
@@ -0,0 +1,42 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class SkipAllVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'skipall',
+ aliases: [
+ 'endqueue',
+ 'endq',
+ 'skipqueue',
+ 'skipq'
+ ],
+ group: 'voice',
+ memberName: 'skipall',
+ description: 'skip all songs in the queue',
+ guildOnly: true,
+ examples: [
+ 's5n!endqueue',
+ 's5n!endq',
+ 's5n!skipqueue',
+ 's5n!skipq'
+ ]
+ });
+ }
+ run(msg) {
+ var voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.reply('join a channel and try again ' + emoji.random());
+
+ if (
+ typeof msg.guild.musicData.songDispatcher == 'undefined' ||
+ msg.guild.musicData.songDispatcher == null
+ ) {
+ return msg.reply('there is no song playing right now ' + emoji.random());
+ }
+ if (!msg.guild.musicData.queue)
+ return msg.say('there are no songs in queue now >:) ' + emoji.random());
+ msg.guild.musicData.songDispatcher.end();
+ msg.guild.musicData.queue.length = 0; // clear queue
+ return;
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/skipto.js b/src/commands/voice/skipto.js
new file mode 100644
index 0000000..65febfd
--- /dev/null
+++ b/src/commands/voice/skipto.js
@@ -0,0 +1,41 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class SkipToVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'skipto',
+ group: 'voice',
+ memberName: 'skipto',
+ description: 'skip to a certain song in da q >_<',
+ guildOnly: true,
+ args: [{
+ key: 'songNumber',
+ prompt: 'what song u want to skip 2 in da q ???',
+ type: 'integer'
+ }],
+ examples: ['s5n!skipto 5']
+ });
+ }
+ run(msg, { songNumber }) {
+ if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) {
+ return msg.reply('enter a valid song number dumb ' + emoji.random());
+ }
+ var voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.reply('join channel and try again for cool ' + emoji.random());
+
+ if (
+ typeof msg.guild.musicData.songDispatcher == 'undefined' ||
+ msg.guild.musicData.songDispatcher == null
+ ) {
+ return msg.reply('there is no song playing right now dumby ' + emoji.random());
+ }
+
+ if (msg.guild.musicData.queue < 1)
+ return msg.reply('there are no songs in queue rn ' + emoji.random());
+
+ msg.guild.musicData.queue.splice(0, songNumber - 1);
+ msg.guild.musicData.songDispatcher.end();
+ return;
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/squeak.js b/src/commands/voice/squeak.js
new file mode 100644
index 0000000..9d2b6a3
--- /dev/null
+++ b/src/commands/voice/squeak.js
@@ -0,0 +1,29 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class SqueakVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'squeak',
+ group: 'voice',
+ memberName: 'squeak',
+ description: 'squeak',
+ guildOnly: true,
+ examples: ['s5n!queak']
+ });
+ }
+ async run(msg) {
+ if (msg.member.voice.channel && !msg.guild.voice) {
+ const connection = await msg.member.voice.channel.join();
+ const dispatcher = connection.play('./assets/audio/squeak.wav');
+
+ dispatcher.on('finish', () => {
+ connection.disconnect();
+ });
+ } else if (msg.guild.voice) {
+ msg.reply('i\'m already playing that lol ' + emoji.random());
+ } else {
+ msg.reply('you need to join a voice channel first silly ' + emoji.random());
+ }
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/volume.js b/src/commands/voice/volume.js
new file mode 100644
index 0000000..bd5f0b0
--- /dev/null
+++ b/src/commands/voice/volume.js
@@ -0,0 +1,43 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class VolumeVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'volume',
+ aliases: ['vol'],
+ group: 'voice',
+ memberName: 'volume',
+ description: 'changes volume of audio if playing',
+ guildOnly: true,
+ args: [
+ {
+ key: 'wantedVol',
+ prompt: 'what volume u want, from 1 to 200',
+ type: 'integer',
+ validate: wantedVol => wantedVol >= 1 && wantedVol <= 200
+ }
+ ],
+ examples: [
+ 's5n!volume 20',
+ 's5n!vol 50'
+ ]
+ });
+ }
+ run(msg, { wantedVol }) {
+ var voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.reply('join a channel and try again ' + emoji.random());
+
+ if (
+ typeof msg.guild.musicData.songDispatcher == 'undefined' ||
+ msg.guild.musicData.songDispatcher == null
+ ) {
+ return msg.reply('there isn\'t a song playing right now lol ' + emoji.random());
+ }
+
+ const volume = wantedVol / 100;
+ msg.guild.musicData.volume = volume;
+ msg.guild.musicData.songDispatcher.setVolume(volume);
+ msg.reply(`volume is now: **${wantedVol}%** ` + emoji.random());
+ }
+}; \ No newline at end of file
diff --git a/src/commands/voice/wahoo.js b/src/commands/voice/wahoo.js
new file mode 100644
index 0000000..a791795
--- /dev/null
+++ b/src/commands/voice/wahoo.js
@@ -0,0 +1,30 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class WahooVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'wahoo',
+ aliases: ['mario'],
+ group: 'voice',
+ memberName: 'wahoo',
+ description: 'wahoo',
+ guildOnly: true,
+ examples: ['s5n!wahoo', 's5n!mario']
+ });
+ }
+ async run(msg) {
+ if (msg.member.voice.channel && !msg.guild.voice) {
+ const connection = await msg.member.voice.channel.join();
+ const dispatcher = connection.play('../../assets/audio/wahoo.mp3');
+
+ dispatcher.on('finish', () => {
+ connection.disconnect();
+ });
+ } else if (msg.guild.voice) {
+ msg.reply('i\'m already playing that lol ' + emoji.random());
+ } else {
+ msg.reply('you need to join a voice channel first silly ' + emoji.random());
+ }
+ }
+}; \ No newline at end of file