From 8c435855e647ee7aef8578e253caf91fe44c67cc Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Thu, 16 Apr 2020 04:56:37 -0700 Subject: The Purification, v7.0.0 add: - aesthetic, oddcase, stretch, surreal - culturedtext - dogeify - howify - insult - lorem - spongebob Other Stuff: - many refactoring --- src/commands/voice/abee.ts | 8 +++---- src/commands/voice/itemshop.ts | 8 +++---- src/commands/voice/join.js | 31 ------------------------ src/commands/voice/join.ts | 31 ++++++++++++++++++++++++ src/commands/voice/leave.js | 34 -------------------------- src/commands/voice/leave.ts | 34 ++++++++++++++++++++++++++ src/commands/voice/loop.js | 34 -------------------------- src/commands/voice/loop.ts | 34 ++++++++++++++++++++++++++ src/commands/voice/minecraft.ts | 8 +++---- src/commands/voice/pause.js | 32 ------------------------- src/commands/voice/pause.ts | 32 +++++++++++++++++++++++++ src/commands/voice/play.ts | 8 +++---- src/commands/voice/psycho.ts | 8 +++---- src/commands/voice/queue.js | 51 --------------------------------------- src/commands/voice/queue.ts | 51 +++++++++++++++++++++++++++++++++++++++ src/commands/voice/remove.js | 41 ------------------------------- src/commands/voice/remove.ts | 41 +++++++++++++++++++++++++++++++ src/commands/voice/resume.js | 32 ------------------------- src/commands/voice/resume.ts | 32 +++++++++++++++++++++++++ src/commands/voice/shuffle.js | 53 ----------------------------------------- src/commands/voice/shuffle.ts | 53 +++++++++++++++++++++++++++++++++++++++++ src/commands/voice/skip.js | 29 ---------------------- src/commands/voice/skip.ts | 29 ++++++++++++++++++++++ src/commands/voice/skipall.js | 44 ---------------------------------- src/commands/voice/skipall.ts | 44 ++++++++++++++++++++++++++++++++++ src/commands/voice/skipto.js | 43 --------------------------------- src/commands/voice/skipto.ts | 43 +++++++++++++++++++++++++++++++++ src/commands/voice/volume.js | 45 ---------------------------------- src/commands/voice/volume.ts | 45 ++++++++++++++++++++++++++++++++++ 29 files changed, 489 insertions(+), 489 deletions(-) delete mode 100644 src/commands/voice/join.js create mode 100644 src/commands/voice/join.ts delete mode 100644 src/commands/voice/leave.js create mode 100644 src/commands/voice/leave.ts delete mode 100644 src/commands/voice/loop.js create mode 100644 src/commands/voice/loop.ts delete mode 100644 src/commands/voice/pause.js create mode 100644 src/commands/voice/pause.ts delete mode 100644 src/commands/voice/queue.js create mode 100644 src/commands/voice/queue.ts delete mode 100644 src/commands/voice/remove.js create mode 100644 src/commands/voice/remove.ts delete mode 100644 src/commands/voice/resume.js create mode 100644 src/commands/voice/resume.ts delete mode 100644 src/commands/voice/shuffle.js create mode 100644 src/commands/voice/shuffle.ts delete mode 100644 src/commands/voice/skip.js create mode 100644 src/commands/voice/skip.ts delete mode 100644 src/commands/voice/skipall.js create mode 100644 src/commands/voice/skipall.ts delete mode 100644 src/commands/voice/skipto.js create mode 100644 src/commands/voice/skipto.ts delete mode 100644 src/commands/voice/volume.js create mode 100644 src/commands/voice/volume.ts (limited to 'src/commands/voice') diff --git a/src/commands/voice/abee.ts b/src/commands/voice/abee.ts index 939b575..2af71af 100644 --- a/src/commands/voice/abee.ts +++ b/src/commands/voice/abee.ts @@ -1,6 +1,6 @@ import ytdl from 'ytdl-core'; -import { Command } from 'discord.js-commando'; -import { MessageEmbed, Message } from 'discord.js'; +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; import Youtube from 'simple-youtube-api'; //const { youtubeAPI } = require('../../config.json'); import config from '../../config.json'; @@ -21,7 +21,7 @@ module.exports = class ABeeVoice extends Command { examples: ['uwu!abee', 'uwu!a-bee'], }); } - async run(msg: Message) { + async run(msg: CommandoMessage) { const voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.say('Please join a channel and try again. ' + emoji.random()); @@ -120,7 +120,7 @@ module.exports = class ABeeVoice extends Command { }); }); } - playSong(queue, msg) { + playSong(queue, msg: CommandoMessage) { const classThis = this; // use classThis instead of 'this' because of lexical scope below queue[0].voiceChannel .join() diff --git a/src/commands/voice/itemshop.ts b/src/commands/voice/itemshop.ts index f8c0b2b..76e1f03 100644 --- a/src/commands/voice/itemshop.ts +++ b/src/commands/voice/itemshop.ts @@ -1,6 +1,6 @@ import ytdl from 'ytdl-core'; -import { Command } from 'discord.js-commando'; -import { MessageEmbed, Message } from 'discord.js'; +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; import Youtube from 'simple-youtube-api'; //const { youtubeAPI } = require('../../config.json'); import config from '../../config.json'; @@ -21,7 +21,7 @@ module.exports = class ABeeVoice extends Command { examples: ['uwu!itemshop', 'uwu!item-shop'] }); } - async run(msg: Message) { + async run(msg: CommandoMessage) { const voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.say('Please join a channel and try again. ' + emoji.random()); @@ -121,7 +121,7 @@ module.exports = class ABeeVoice extends Command { }); }); } - playSong(queue, msg) { + playSong(queue, msg: CommandoMessage) { const classThis = this; // use classThis instead of 'this' because of lexical scope below queue[0].voiceChannel .join() diff --git a/src/commands/voice/join.js b/src/commands/voice/join.js deleted file mode 100644 index 4410e4c..0000000 --- a/src/commands/voice/join.js +++ /dev/null @@ -1,31 +0,0 @@ -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 current voice channel.', - throttling: { - usages: 2, - duration: 5 - }, - guildOnly: true, - examples: ['uwu!join'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - 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('Please join a channel and try again. ' + emoji.random()); - } - } -}; \ No newline at end of file diff --git a/src/commands/voice/join.ts b/src/commands/voice/join.ts new file mode 100644 index 0000000..ce414f4 --- /dev/null +++ b/src/commands/voice/join.ts @@ -0,0 +1,31 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class JoinVoice extends Command { + constructor(client) { + super(client, { + name: 'join', + group: 'voice', + memberName: 'join', + description: 'Joins your current voice channel.', + throttling: { + usages: 2, + duration: 5 + }, + guildOnly: true, + examples: ['uwu!join'], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage) { + 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('Please join a channel and try again. ' + emoji.random()); + } + } +}; \ No newline at end of file diff --git a/src/commands/voice/leave.js b/src/commands/voice/leave.js deleted file mode 100644 index 4c25e62..0000000 --- a/src/commands/voice/leave.js +++ /dev/null @@ -1,34 +0,0 @@ -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: 'Leaves voice channel and stops currently playing audio.', - guildOnly: true, - examples: ['uwu!leave', 'uwu!end', 'uwu!stop'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + emoji.random()); - } - if (!msg.guild.musicData.queue) - return msg.say('There aren\'t any songs in the current queue. ' + 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/leave.ts b/src/commands/voice/leave.ts new file mode 100644 index 0000000..bdcf259 --- /dev/null +++ b/src/commands/voice/leave.ts @@ -0,0 +1,34 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class LeaveVoice extends Command { + constructor(client) { + super(client, { + name: 'leave', + aliases: ['end', 'stop'], + group: 'voice', + memberName: 'leave', + description: 'Leaves voice channel and stops currently playing audio.', + guildOnly: true, + examples: ['uwu!leave', 'uwu!end', 'uwu!stop'], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage) { + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + emoji.random()); + } + if (!msg.guild.musicData.queue) + return msg.say('There aren\'t any songs in the current queue. ' + 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 deleted file mode 100644 index 05c0e99..0000000 --- a/src/commands/voice/loop.js +++ /dev/null @@ -1,34 +0,0 @@ -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: ['uwu!loop', 'uwu!repeat'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + 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/loop.ts b/src/commands/voice/loop.ts new file mode 100644 index 0000000..a3bda2a --- /dev/null +++ b/src/commands/voice/loop.ts @@ -0,0 +1,34 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from '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: ['uwu!loop', 'uwu!repeat'], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage) { + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + 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/minecraft.ts b/src/commands/voice/minecraft.ts index cad7c06..ea8fb6d 100644 --- a/src/commands/voice/minecraft.ts +++ b/src/commands/voice/minecraft.ts @@ -1,5 +1,5 @@ import ytdl from 'ytdl-core'; -import { Command } from 'discord.js-commando'; +import { Command, CommandoMessage } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; import Youtube from 'simple-youtube-api'; //const { youtubeAPI } = require('../../config.json'); @@ -27,9 +27,9 @@ module.exports = class MinecraftVoice extends Command { ] }); } - async run(msg) { + async run(msg: CommandoMessage) { const voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.say('Join a channel and try again. ' + emoji.random()); + if (!voiceChannel) return msg.say('Please join a channel and try again. ' + emoji.random()); const playlist = await youtube.getPlaylist('https://www.youtube.com/watch?v=05UM-i4PuOY&list=PLxOTV5xn7n1i2HcKtRBthP2loWjrBGAIY').catch(function () { return msg.say('There was a problem getting the soundtrack. ' + emoji.random()); @@ -125,7 +125,7 @@ module.exports = class MinecraftVoice extends Command { }); }); } - playSong(queue, msg) { + playSong(queue, msg: CommandoMessage) { const classThis = this; // use classThis instead of 'this' because of lexical scope below queue[0].voiceChannel .join() diff --git a/src/commands/voice/pause.js b/src/commands/voice/pause.js deleted file mode 100644 index 6ab6fb0..0000000 --- a/src/commands/voice/pause.js +++ /dev/null @@ -1,32 +0,0 @@ -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 audio of previously playing.', - guildOnly: true, - examples: ['uwu!pause'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + 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/pause.ts b/src/commands/voice/pause.ts new file mode 100644 index 0000000..c2475d2 --- /dev/null +++ b/src/commands/voice/pause.ts @@ -0,0 +1,32 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class PauseVoice extends Command { + constructor(client) { + super(client, { + name: 'pause', + group: 'voice', + memberName: 'pause', + description: 'Pauses audio of previously playing.', + guildOnly: true, + examples: ['uwu!pause'], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage) { + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + 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.ts b/src/commands/voice/play.ts index 61cf5d4..b60cb73 100644 --- a/src/commands/voice/play.ts +++ b/src/commands/voice/play.ts @@ -1,6 +1,6 @@ import ytdl from 'ytdl-core'; -import { Command } from 'discord.js-commando'; -import { MessageEmbed, Message } from 'discord.js'; +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; import Youtube from 'simple-youtube-api'; //const { youtubeAPI } = require('../../config.json'); import config from '../../config.json'; @@ -33,7 +33,7 @@ module.exports = class PlayVoice extends Command { ] }); } - async run(msg: Message, { query }) { + async run(msg: CommandoMessage, { query }) { const voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.say('Please join a channel and try again. ' + emoji.random()); @@ -213,7 +213,7 @@ module.exports = class PlayVoice extends Command { ); }); } - playSong(queue, msg) { + playSong(queue, msg: CommandoMessage) { const classThis = this; // use classThis instead of 'this' because of lexical scope below queue[0].voiceChannel .join() diff --git a/src/commands/voice/psycho.ts b/src/commands/voice/psycho.ts index 827c00a..115b0b8 100644 --- a/src/commands/voice/psycho.ts +++ b/src/commands/voice/psycho.ts @@ -1,6 +1,6 @@ import ytdl from 'ytdl-core'; -import { Command } from 'discord.js-commando'; -import { MessageEmbed, Message } from 'discord.js'; +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; import Youtube from 'simple-youtube-api'; //const { youtubeAPI } = require('../../config.json'); import config from '../../config.json'; @@ -20,7 +20,7 @@ module.exports = class PsychoVoice extends Command { examples: ['uwu!psycho'] }); } - async run(msg: Message, { query }) { + async run(msg: CommandoMessage, { query }) { const voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.say('Please join a channel and try again. ' + emoji.random()); @@ -119,7 +119,7 @@ module.exports = class PsychoVoice extends Command { }); }); } - playSong(queue, msg) { + playSong(queue, msg: CommandoMessage) { const classThis = this; // use classThis instead of 'this' because of lexical scope below queue[0].voiceChannel .join() diff --git a/src/commands/voice/queue.js b/src/commands/voice/queue.js deleted file mode 100644 index 59fce1a..0000000 --- a/src/commands/voice/queue.js +++ /dev/null @@ -1,51 +0,0 @@ -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: 'Displays the current queue.', - guildOnly: true, - examples: [ - 'uwu!queue', - 'uwu!q', - 'uwu!songlist', - 'uwu!song-list', - 'uwu!nextsong', - 'uwu!next-song', - 'uwu!nextsongs', - 'uwu!next-songs' - ], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg) { - if (msg.guild.musicData.queue.length == 0) - return msg.say('There aren\'t any songs in the current queue. ' + emoji.random()); - const titleArray = []; - msg.guild.musicData.queue.map(obj => { - titleArray.push(obj.title); - }); - let queueEmbed = new MessageEmbed() - .setColor(0xFFCC4D) - .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/queue.ts b/src/commands/voice/queue.ts new file mode 100644 index 0000000..b92852a --- /dev/null +++ b/src/commands/voice/queue.ts @@ -0,0 +1,51 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed }from 'discord.js'; +import emoji from '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: 'Displays the current queue.', + guildOnly: true, + examples: [ + 'uwu!queue', + 'uwu!q', + 'uwu!songlist', + 'uwu!song-list', + 'uwu!nextsong', + 'uwu!next-song', + 'uwu!nextsongs', + 'uwu!next-songs' + ], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage) { + if (msg.guild.musicData.queue.length == 0) + return msg.say('There aren\'t any songs in the current queue. ' + emoji.random()); + const titleArray = []; + msg.guild.musicData.queue.map(obj => { + titleArray.push(obj.title); + }); + let queueEmbed = new MessageEmbed() + .setColor(0xFFCC4D) + .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 deleted file mode 100644 index 34a30de..0000000 --- a/src/commands/voice/remove.js +++ /dev/null @@ -1,41 +0,0 @@ -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 current queue.', - guildOnly: true, - args: [ - { - key: 'songNumber', - prompt: 'What song would you like to remove from the current queue?', - type: 'integer' - } - ], - examples: ['uwu!remove 2'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg, { songNumber }) { - if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) { - return msg.reply('Please enter a valid song. ' + emoji.random()); - } - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + emoji.random()); - } - - msg.guild.musicData.queue.splice(songNumber - 1, 1); - return msg.say(`Removed song **#${songNumber}** from current queue. ` + emoji.random()); - } -}; \ No newline at end of file diff --git a/src/commands/voice/remove.ts b/src/commands/voice/remove.ts new file mode 100644 index 0000000..5d84f0c --- /dev/null +++ b/src/commands/voice/remove.ts @@ -0,0 +1,41 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class RemoveVoice extends Command { + constructor(client) { + super(client, { + name: 'remove', + group: 'voice', + memberName: 'remove', + description: 'Removes a song from the current queue.', + guildOnly: true, + args: [ + { + key: 'songNumber', + prompt: 'What song would you like to remove from the current queue?', + type: 'integer' + } + ], + examples: ['uwu!remove 2'], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage, { songNumber }) { + if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) { + return msg.reply('Please enter a valid song. ' + emoji.random()); + } + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + emoji.random()); + } + + msg.guild.musicData.queue.splice(songNumber - 1, 1); + return msg.say(`Removed song **#${songNumber}** from current queue. ` + emoji.random()); + } +}; \ No newline at end of file diff --git a/src/commands/voice/resume.js b/src/commands/voice/resume.js deleted file mode 100644 index 1b28b28..0000000 --- a/src/commands/voice/resume.js +++ /dev/null @@ -1,32 +0,0 @@ -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 audio of previously paused.', - guildOnly: true, - examples: ['uwu!resume'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + 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/resume.ts b/src/commands/voice/resume.ts new file mode 100644 index 0000000..39874df --- /dev/null +++ b/src/commands/voice/resume.ts @@ -0,0 +1,32 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class ResumeVoice extends Command { + constructor(client) { + super(client, { + name: 'resume', + group: 'voice', + memberName: 'resume', + description: 'Resumes audio of previously paused.', + guildOnly: true, + examples: ['uwu!resume'], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage) { + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + 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 deleted file mode 100644 index 3183f87..0000000 --- a/src/commands/voice/shuffle.js +++ /dev/null @@ -1,53 +0,0 @@ -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: 'Shuffles the current queue.', - guildOnly: true, - examples: ['uwu!shuffle'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join channel and try again. ' + emoji.random()); - - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - - if (msg.guild.musicData.queue.length < 1) - return msg.say('There aren\'t any songs in the current 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 Queue ' + 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/shuffle.ts b/src/commands/voice/shuffle.ts new file mode 100644 index 0000000..c50181f --- /dev/null +++ b/src/commands/voice/shuffle.ts @@ -0,0 +1,53 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; +import emoji from 'emoji-random'; + +module.exports = class ShuffleVoice extends Command { + constructor(client) { + super(client, { + name: 'shuffle', + group: 'voice', + memberName: 'shuffle', + description: 'Shuffles the current queue.', + guildOnly: true, + examples: ['uwu!shuffle'], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage) { + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('Please join channel and try again. ' + emoji.random()); + + if ( + typeof msg.guild.musicData.songDispatcher == 'undefined' || + msg.guild.musicData.songDispatcher == null + ) { + return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); + } + + if (msg.guild.musicData.queue.length < 1) + return msg.say('There aren\'t any songs in the current 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 Queue ' + 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 deleted file mode 100644 index 8638291..0000000 --- a/src/commands/voice/skip.js +++ /dev/null @@ -1,29 +0,0 @@ -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: 'Skips one song ahead in the current queue.', - guildOnly: true, - examples: ['uwu!skip'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg) { - const voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + emoji.random()); - } - msg.guild.musicData.songDispatcher.end(); - } -}; \ No newline at end of file diff --git a/src/commands/voice/skip.ts b/src/commands/voice/skip.ts new file mode 100644 index 0000000..c8c4c62 --- /dev/null +++ b/src/commands/voice/skip.ts @@ -0,0 +1,29 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class SkipVoice extends Command { + constructor(client) { + super(client, { + name: 'skip', + group: 'voice', + memberName: 'skip', + description: 'Skips one song ahead in the current queue.', + guildOnly: true, + examples: ['uwu!skip'], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage) { + const voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + 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 deleted file mode 100644 index e981f46..0000000 --- a/src/commands/voice/skipall.js +++ /dev/null @@ -1,44 +0,0 @@ -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: 'Removes all the songs from current queue.', - guildOnly: true, - examples: [ - 'uwu!endqueue', - 'uwu!endq', - 'uwu!skipqueue', - 'uwu!skipq' - ], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + emoji.random()); - } - if (!msg.guild.musicData.queue) - return msg.say('There aren\'t any songs in the current queue. ' + 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/skipall.ts b/src/commands/voice/skipall.ts new file mode 100644 index 0000000..dbcfeb5 --- /dev/null +++ b/src/commands/voice/skipall.ts @@ -0,0 +1,44 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class SkipAllVoice extends Command { + constructor(client) { + super(client, { + name: 'skipall', + aliases: [ + 'endqueue', + 'endq', + 'skipqueue', + 'skipq' + ], + group: 'voice', + memberName: 'skipall', + description: 'Removes all the songs from current queue.', + guildOnly: true, + examples: [ + 'uwu!endqueue', + 'uwu!endq', + 'uwu!skipqueue', + 'uwu!skipq' + ], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage) { + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + emoji.random()); + } + if (!msg.guild.musicData.queue) + return msg.say('There aren\'t any songs in the current queue. ' + 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 deleted file mode 100644 index f43d56c..0000000 --- a/src/commands/voice/skipto.js +++ /dev/null @@ -1,43 +0,0 @@ -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 the current queue.', - guildOnly: true, - args: [{ - key: 'songNumber', - prompt: 'What song would you like to skip to in the current queue?', - type: 'integer' - }], - examples: ['uwu!skipto 5'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg, { songNumber }) { - if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) { - return msg.reply('Please enter a valid song. ' + emoji.random()); - } - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join channel and try again. ' + emoji.random()); - - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - - if (msg.guild.musicData.queue < 1) - return msg.reply('There aren\'t any songs in the current queue. ' + 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/skipto.ts b/src/commands/voice/skipto.ts new file mode 100644 index 0000000..fab0d68 --- /dev/null +++ b/src/commands/voice/skipto.ts @@ -0,0 +1,43 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from '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 the current queue.', + guildOnly: true, + args: [{ + key: 'songNumber', + prompt: 'What song would you like to skip to in the current queue?', + type: 'integer' + }], + examples: ['uwu!skipto 5'], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage, { songNumber }) { + if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) { + return msg.reply('Please enter a valid song. ' + emoji.random()); + } + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('Please join channel and try again. ' + emoji.random()); + + if ( + typeof msg.guild.musicData.songDispatcher == 'undefined' || + msg.guild.musicData.songDispatcher == null + ) { + return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); + } + + if (msg.guild.musicData.queue < 1) + return msg.reply('There aren\'t any songs in the current queue. ' + 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/volume.js b/src/commands/voice/volume.js deleted file mode 100644 index 96a6de3..0000000 --- a/src/commands/voice/volume.js +++ /dev/null @@ -1,45 +0,0 @@ -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 any currentaly playing audio.', - guildOnly: true, - args: [ - { - key: 'wantedVol', - prompt: 'What would volume you like? (1 to 200)', - type: 'integer', - validate: wantedVol => wantedVol >= 1 && wantedVol <= 200 - } - ], - examples: [ - 'uwu!volume 20', - 'uwu!vol 50' - ], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg, { wantedVol }) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + 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/volume.ts b/src/commands/voice/volume.ts new file mode 100644 index 0000000..debd798 --- /dev/null +++ b/src/commands/voice/volume.ts @@ -0,0 +1,45 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class VolumeVoice extends Command { + constructor(client) { + super(client, { + name: 'volume', + aliases: ['vol'], + group: 'voice', + memberName: 'volume', + description: 'Changes volume of any currentaly playing audio.', + guildOnly: true, + args: [ + { + key: 'wantedVol', + prompt: 'What would volume you like? (1 to 200)', + type: 'integer', + validate: wantedVol => wantedVol >= 1 && wantedVol <= 200 + } + ], + examples: [ + 'uwu!volume 20', + 'uwu!vol 50' + ], + clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage, { wantedVol }) { + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('Please 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 any audio playing right now. ' + 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 -- cgit v1.2.3