diff --git a/commands/Music/clear.js b/commands/Music/clear.js index cfd82bf..c49fa86 100644 --- a/commands/Music/clear.js +++ b/commands/Music/clear.js @@ -21,6 +21,20 @@ module.exports = { }); } + const checkdj = await client.db.get(`djRole_${message.guildId}`); + const userRoles = await message.member.roles.cache.map((role) => role.id); + + if (checkdj && !userRoles.includes(checkdj)) { + return await message.channel.send({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + try { if (queue) { await queue.clear(); @@ -64,6 +78,22 @@ module.exports = { }); } + const checkdj = await client.db.get(`djRole_${interaction.guildId}`); + const userRoles = await interaction.member.roles.cache.map( + (role) => role.id + ); + + if (checkdj && !userRoles.includes(checkdj)) { + return await interaction.followUp({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + try { if (queue) { await queue.clear(); diff --git a/commands/Music/disconnect.js b/commands/Music/disconnect.js index d6dbf7e..a61041d 100644 --- a/commands/Music/disconnect.js +++ b/commands/Music/disconnect.js @@ -24,10 +24,27 @@ module.exports = { ) return await message.channel.send({ embeds: [ - embedMessage("#9dcc37", `❌ | You must be in my voice channel to disconnect me!`), + embedMessage( + "#9dcc37", + `❌ | You must be in my voice channel to disconnect me!` + ), ], }); + const checkdj = await client.db.get(`djRole_${message.guildId}`); + const userRoles = await message.member.roles.cache.map((role) => role.id); + + if (checkdj && !userRoles.includes(checkdj)) { + return await message.channel.send({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + try { if (queue) { await queue.connection.disconnect(); @@ -70,14 +87,33 @@ module.exports = { if ( interaction.guild.me.voice.channelId && - interaction.member.voice.channelId !== interaction.guild.me.voice.channelId + interaction.member.voice.channelId !== + interaction.guild.me.voice.channelId ) return await interaction.followUp({ embeds: [ - embedMessage("#9dcc37", `❌ | You must be in my voice channel to disconnect me!`), + embedMessage( + "#9dcc37", + `❌ | You must be in my voice channel to disconnect me!` + ), ], }); + const checkdj = await client.db.get(`djRole_${interaction.guildId}`); + const userRoles = await interaction.member.roles.cache.map( + (role) => role.id + ); + + if (checkdj && !userRoles.includes(checkdj)) { + return await interaction.followUp({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } try { if (queue) { diff --git a/commands/Music/jump.js b/commands/Music/jump.js index 2a5029a..f164fe4 100644 --- a/commands/Music/jump.js +++ b/commands/Music/jump.js @@ -19,6 +19,20 @@ module.exports = { ], }); + const checkdj = await client.db.get(`djRole_${message.guildId}`); + const userRoles = await message.member.roles.cache.map((role) => role.id); + + if (checkdj && !userRoles.includes(checkdj)) { + return await message.channel.send({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + if (!args[0]) return await message.channel.send({ embeds: [ @@ -67,6 +81,22 @@ module.exports = { ], }); + const checkdj = await client.db.get(`djRole_${interaction.guildId}`); + const userRoles = await interaction.member.roles.cache.map( + (role) => role.id + ); + + if (checkdj && !userRoles.includes(checkdj)) { + return await interaction.followUp({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + try { if (queue) { await queue.jump(Number(position)); diff --git a/commands/Music/pause.js b/commands/Music/pause.js index bc95634..facc54b 100644 --- a/commands/Music/pause.js +++ b/commands/Music/pause.js @@ -16,6 +16,20 @@ module.exports = { ], }); + const checkdj = await client.db.get(`djRole_${message.guildId}`); + const userRoles = await message.member.roles.cache.map((role) => role.id); + + if (checkdj && !userRoles.includes(checkdj)) { + return await message.channel.send({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + try { if (queue) { await queue.setPaused(true); @@ -52,6 +66,22 @@ module.exports = { ], }); + const checkdj = await client.db.get(`djRole_${interaction.guildId}`); + const userRoles = await interaction.member.roles.cache.map( + (role) => role.id + ); + + if (checkdj && !userRoles.includes(checkdj)) { + return await interaction.followUp({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + try { if (queue) { await queue.setPaused(true); diff --git a/commands/Music/playskip.js b/commands/Music/playskip.js index 56df602..3d00ebf 100644 --- a/commands/Music/playskip.js +++ b/commands/Music/playskip.js @@ -21,6 +21,20 @@ module.exports = { ], }); + const checkdj = await client.db.get(`djRole_${message.guildId}`); + const userRoles = await message.member.roles.cache.map((role) => role.id); + + if (checkdj && !userRoles.includes(checkdj)) { + return await message.channel.send({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + if (!songString) return await message.channel.send({ embeds: [ @@ -152,6 +166,22 @@ module.exports = { ], }); + const checkdj = await client.db.get(`djRole_${interaction.guildId}`); + const userRoles = await interaction.member.roles.cache.map( + (role) => role.id + ); + + if (checkdj && !userRoles.includes(checkdj)) { + return await interaction.followUp({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + const songString = interaction.options.getString("song"); const searchSong = await client.player.search(songString, { requestedBy: interaction.user, diff --git a/commands/Music/repeat.js b/commands/Music/repeat.js index 2a338ed..061ef26 100644 --- a/commands/Music/repeat.js +++ b/commands/Music/repeat.js @@ -17,6 +17,20 @@ module.exports = { }); } + const checkdj = await client.db.get(`djRole_${message.guildId}`); + const userRoles = await message.member.roles.cache.map((role) => role.id); + + if (checkdj && !userRoles.includes(checkdj)) { + return await message.channel.send({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + switch (mode) { case "off": await queue.setRepeatMode(0); @@ -90,6 +104,22 @@ module.exports = { }); } + const checkdj = await client.db.get(`djRole_${interaction.guildId}`); + const userRoles = await interaction.member.roles.cache.map( + (role) => role.id + ); + + if (checkdj && !userRoles.includes(checkdj)) { + return await interaction.followUp({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + switch (mode) { case "0": await queue.setRepeatMode(Number(mode)); diff --git a/commands/Music/resume.js b/commands/Music/resume.js index 3235c87..7ba83c2 100644 --- a/commands/Music/resume.js +++ b/commands/Music/resume.js @@ -17,6 +17,20 @@ module.exports = { ], }); + const checkdj = await client.db.get(`djRole_${message.guildId}`); + const userRoles = await message.member.roles.cache.map((role) => role.id); + + if (checkdj && !userRoles.includes(checkdj)) { + return await message.channel.send({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + try { if (queue) { await queue.setPaused(false); @@ -53,6 +67,22 @@ module.exports = { ], }); + const checkdj = await client.db.get(`djRole_${interaction.guildId}`); + const userRoles = await interaction.member.roles.cache.map( + (role) => role.id + ); + + if (checkdj && !userRoles.includes(checkdj)) { + return await interaction.followUp({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + try { if (queue) { await queue.setPaused(false); diff --git a/commands/Music/skip.js b/commands/Music/skip.js index e652fed..39431ce 100644 --- a/commands/Music/skip.js +++ b/commands/Music/skip.js @@ -20,6 +20,20 @@ module.exports = { ], }); + const checkdj = await client.db.get(`djRole_${message.guildId}`); + const userRoles = await message.member.roles.cache.map((role) => role.id); + + if (checkdj && !userRoles.includes(checkdj)) { + return await message.channel.send({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + try { const currnetSong = queue.current; await queue.skip(); @@ -56,6 +70,22 @@ module.exports = { ], }); + const checkdj = await client.db.get(`djRole_${interaction.guildId}`); + const userRoles = await interaction.member.roles.cache.map( + (role) => role.id + ); + + if (checkdj && !userRoles.includes(checkdj)) { + return await interaction.followUp({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + try { const currnetSong = queue.current; await queue.skip(); diff --git a/commands/Music/stop.js b/commands/Music/stop.js index dea4ce2..bd27f94 100644 --- a/commands/Music/stop.js +++ b/commands/Music/stop.js @@ -19,7 +19,19 @@ module.exports = { ], }); } + const checkdj = await client.db.get(`djRole_${message.guildId}`); + const userRoles = await message.member.roles.cache.map((role) => role.id); + if (checkdj && !userRoles.includes(checkdj)) { + return await message.channel.send({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } try { if (queue && queue.playing) { await message.channel.send({ @@ -58,6 +70,22 @@ module.exports = { }); } + const checkdj = await client.db.get(`djRole_${interaction.guildId}`); + const userRoles = await interaction.member.roles.cache.map( + (role) => role.id + ); + + if (checkdj && !userRoles.includes(checkdj)) { + return await interaction.followUp({ + embeds: [ + embedMessage( + "#9dcc37", + `You are not allowed to use this command.\n This command is only available for users with the DJ Role: <@&${checkdj}>` + ), + ], + }); + } + try { if (queue && queue.playing) { await interaction.followUp({