From ca61906f57fd8f501a07a8233c88ee5a0a1df6c6 Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Sun, 13 Oct 2019 10:33:59 +0300 Subject: [PATCH] DJ role support --- commands/loop.js | 4 +++- commands/pause.js | 4 +++- commands/playlist.js | 6 ++++-- commands/resume.js | 4 +++- commands/seek.js | 4 +++- commands/settings.js | 32 ++++++++++++++++++++++++++++---- commands/skip.js | 4 +++- commands/stop.js | 4 +++- commands/volume.js | 4 +++- events/guildcreate.js | 4 ++++ events/message.js | 4 ++++ events/ready.js | 2 ++ index.js | 2 +- 13 files changed, 64 insertions(+), 14 deletions(-) diff --git a/commands/loop.js b/commands/loop.js index 5376611c..e243fb4d 100644 --- a/commands/loop.js +++ b/commands/loop.js @@ -10,7 +10,9 @@ module.exports = { if (message.author.id !== '360363051792203779') { if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voiceChannel as Musix to loop the queue!'); if (client.global.db.guilds[message.guild.id].permissions === true) { - if (!permissions.has('MANAGE_MESSAGES')) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to loop the queue!'); + 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 loop the queue!'); + } else if (!permissions.has('MANAGE_MESSAGES')) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to loop the queue!'); } } if (!serverQueue.looping) { diff --git a/commands/pause.js b/commands/pause.js index 635076f1..5b0e85a2 100644 --- a/commands/pause.js +++ b/commands/pause.js @@ -10,7 +10,9 @@ module.exports = { if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voiceChannel as Musix to pause the music!'); if (message.author.id !== '360363051792203779') { if (client.global.db.guilds[message.guild.id].permissions === true) { - if (!permissions.has('MANAGE_MESSAGES')) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to pause the music!'); + 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!'); + } else if (!permissions.has('MANAGE_MESSAGES')) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to pause the music!'); } } serverQueue.playing = false; diff --git a/commands/playlist.js b/commands/playlist.js index 1e7e8688..56bd5c3d 100644 --- a/commands/playlist.js +++ b/commands/playlist.js @@ -7,7 +7,9 @@ module.exports = { const permissions = message.channel.permissionsFor(message.author); const serverQueue = client.queue.get(message.guild.id); if (message.author.id !== '360363051792203779') { - if (!permissions.has('MANAGE_GUILD')) return message.channel.send(':x: You need the `MANAGE_SERVER` permission to modify the playlist!'); + 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 modify or play the playlist!'); + } else if (!permissions.has('MANAGE_GUILD')) return message.channel.send(':x: You need the `MANAGE_SERVER` permission to modify the playlist!'); } if (client.global.db.guilds[message.guild.id].premium) { if (args[1] === 'play') { @@ -49,7 +51,7 @@ module.exports = { const embed = new Discord.RichEmbed() .setTitle('Options for playlist!') .addField('play', 'Play the guild specific queue.', true) - .addField('save', 'Save the currently playing queue.') + .addField('save', 'Save the currently playing queue.', true) .setFooter(`how to use: ${prefix}playlist