From 8615735431d8f828e7d525da2d919fac9ea79d43 Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Thu, 31 Oct 2019 20:29:26 +0200 Subject: [PATCH] Option handler for playlists and settings. Exe function to execute command files. Command aliases updated. --- commands/bug.js | 1 + commands/eval.js | 3 +- commands/forcestop.js | 3 +- commands/help.js | 1 + commands/invite.js | 1 + commands/loop.js | 3 +- commands/nowplaying.js | 1 + commands/pause.js | 3 +- commands/play.js | 1 + commands/playlist.js | 163 +++++------------------------ commands/playlist/add.js | 51 +++++++++ commands/playlist/list.js | 22 ++++ commands/playlist/play.js | 51 +++++++++ commands/playlist/remove.js | 14 +++ commands/playlist/save.js | 13 +++ commands/queue.js | 1 + commands/remove.js | 3 +- commands/resume.js | 3 +- commands/seek.js | 3 +- commands/settings.js | 119 +++++---------------- commands/settings/announcesongs.js | 12 +++ commands/settings/permissions.js | 17 +++ commands/settings/prefix.js | 8 ++ commands/settings/setDj.js | 27 +++++ commands/settings/setpremium.js | 34 ++++++ commands/settings/volume.js | 10 ++ commands/skip.js | 3 +- commands/status.js | 1 + commands/stop.js | 5 +- commands/volume.js | 3 +- events/message.js | 53 +++------- funcs/exe.js | 15 +++ index.js | 21 +++- 33 files changed, 392 insertions(+), 277 deletions(-) create mode 100644 commands/playlist/add.js create mode 100644 commands/playlist/list.js create mode 100644 commands/playlist/play.js create mode 100644 commands/playlist/remove.js create mode 100644 commands/playlist/save.js create mode 100644 commands/settings/announcesongs.js create mode 100644 commands/settings/permissions.js create mode 100644 commands/settings/prefix.js create mode 100644 commands/settings/setDj.js create mode 100644 commands/settings/setpremium.js create mode 100644 commands/settings/volume.js create mode 100644 funcs/exe.js diff --git a/commands/bug.js b/commands/bug.js index 88bdd70d..c6855486 100644 --- a/commands/bug.js +++ b/commands/bug.js @@ -1,6 +1,7 @@ module.exports = { name: 'bug', description: 'Report a bug', + alias: 'bug', cooldown: 5, async execute(message, args, client, Discord, prefix) { const embed = new Discord.RichEmbed() diff --git a/commands/eval.js b/commands/eval.js index 88e2630f..8065592c 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -1,6 +1,7 @@ module.exports = { name: 'eval', description: 'Evaluation command', + alias: 'eval', cooldown: 5, async execute(message, args, client, Discord, prefix) { const ytdl = require('ytdl-core'); @@ -8,7 +9,7 @@ module.exports = { if (serverQueue) { let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); } - if (message.author.id !== '360363051792203779') return message.channel.send(':x: You are not allowed to do that!'); + if (message.author.id !== client.global.devId) return message.channel.send(':x: You are not allowed to do that!'); const input = message.content.slice(prefix.length + 4); let output; try { diff --git a/commands/forcestop.js b/commands/forcestop.js index 415e4a23..4548ea13 100644 --- a/commands/forcestop.js +++ b/commands/forcestop.js @@ -1,9 +1,10 @@ module.exports = { name: 'forcestop', description: 'force stop command.', + alias: 'fs', cooldown: 5, execute(message, args, client, Discord, prefix) { - if (message.author.id !== '360363051792203779') return message.channel.send(':x: You are not allowed to do that!') + if (message.author.id !== client.global.devId) return message.channel.send(':x: You are not allowed to do that!') client.queue.delete(message.guild.id); message.channel.send('queue deleted') } diff --git a/commands/help.js b/commands/help.js index 0c75e2dc..7c4c68fe 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,6 +1,7 @@ module.exports = { name: 'help', description: 'Help command.', + alias: 'help', cooldown: 5, execute(message, args, client, Discord, prefix) { const embed = new Discord.RichEmbed() diff --git a/commands/invite.js b/commands/invite.js index b4fbbf58..1f464a25 100644 --- a/commands/invite.js +++ b/commands/invite.js @@ -1,6 +1,7 @@ module.exports = { name: 'invite', description: 'Invite command.', + alias: 'invite', cooldown: 5, execute(message, args, client, Discord, prefix) { const embed = new Discord.RichEmbed() diff --git a/commands/loop.js b/commands/loop.js index 9ef44885..9655089c 100644 --- a/commands/loop.js +++ b/commands/loop.js @@ -1,13 +1,14 @@ module.exports = { name: 'loop', description: 'loop command.', + alias: 'loop', cooldown: 10, async execute(message, args, client, Discord, prefix) { const serverQueue = client.queue.get(message.guild.id); const permissions = message.channel.permissionsFor(message.author); const { voiceChannel } = message.member; if (serverQueue) { - if (message.author.id !== '360363051792203779') { + if (message.author.id !== client.global.devId) { if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to loop the queue!'); if (client.global.db.guilds[message.guild.id].permissions === true) { if (client.global.db.guilds[message.guild.id].dj) { diff --git a/commands/nowplaying.js b/commands/nowplaying.js index b33528dd..7002ba00 100644 --- a/commands/nowplaying.js +++ b/commands/nowplaying.js @@ -1,6 +1,7 @@ module.exports = { name: 'nowplaying', description: 'Now playing command.', + alias: 'np', cooldown: 5, async execute(message, args, client, Discord, prefix) { const ytdl = require('ytdl-core'); diff --git a/commands/pause.js b/commands/pause.js index 31a9bfd6..955d7cf6 100644 --- a/commands/pause.js +++ b/commands/pause.js @@ -1,6 +1,7 @@ module.exports = { name: 'pause', description: 'Pause command.', + alias: 'pause', cooldown: 5, execute(message, args, client, Discord, prefix) { const serverQueue = client.queue.get(message.guild.id); @@ -8,7 +9,7 @@ module.exports = { const { voiceChannel } = message.member; if (serverQueue && serverQueue.playing === true) { if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to pause the music!'); - if (message.author.id !== '360363051792203779') { + if (message.author.id !== client.global.devId) { if (client.global.db.guilds[message.guild.id].permissions === true) { if (client.global.db.guilds[message.guild.id].dj) { if (!message.member.roles.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to pause the music!'); diff --git a/commands/play.js b/commands/play.js index 37f416ac..b1836cd4 100644 --- a/commands/play.js +++ b/commands/play.js @@ -5,6 +5,7 @@ module.exports = { name: 'play', description: 'Play command.', usage: '[song name]', + alias: 'p', args: true, cooldown: 3, async execute(message, args, client, Discord, prefix) { diff --git a/commands/playlist.js b/commands/playlist.js index ef889596..33f259ac 100644 --- a/commands/playlist.js +++ b/commands/playlist.js @@ -5,152 +5,43 @@ module.exports = { name: 'playlist', usage: '[option]', description: 'Save and load queues', + alias: 'pl', cooldown: 10, async execute(message, args, client, Discord, prefix) { + const embed = new Discord.RichEmbed() + .setTitle('Options for playlist!') + .addField('play', 'Play the guild specific queue.', true) + .addField('save', 'Save the currently playing queue. Note that this will overwrite the currently saved queue!', true) + .addField('add', 'Add songs to the playlist. Like song selection', true) + .addField('remove', 'Remove songs from the playlist.', true) + .addField('list', 'Display the playlist.', true) + .setFooter(`how to use: ${prefix}playlist