mirror of
https://github.com/musix-org/musix-oss
synced 2024-11-10 05:10:17 +00:00
DJ role support
This commit is contained in:
parent
1b4dd3921b
commit
ca61906f57
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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 <Option>`)
|
||||
.setAuthor(client.user.username, client.user.displayAvatarURL)
|
||||
.setColor('#b50002')
|
||||
|
@ -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 resume 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 resume the music!');
|
||||
} else if (!permissions.has('MANAGE_MESSAGES')) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to resume the music!');
|
||||
}
|
||||
}
|
||||
serverQueue.playing = true;
|
||||
|
@ -13,7 +13,9 @@ module.exports = {
|
||||
return message.channel.send(':x: This command is currently disabled!');
|
||||
if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voiceChannel as Musix to seek the song!');
|
||||
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 seek the song!');
|
||||
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 seek the song!');
|
||||
} else if (!permissions.has('MANAGE_MESSAGES')) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to seek the song!');
|
||||
}
|
||||
}
|
||||
if (!args[1]) return message.channel.send(`:x: Correct usage: \`${prefix}seek <seeking point in seconds>\``);
|
||||
|
@ -21,17 +21,17 @@ module.exports = {
|
||||
} else if (args[1] === 'permissions') {
|
||||
if (!args[2]) return message.channel.send(`🔒 Permission requirement: \`${client.global.db.guilds[message.guild.id].permissions}\``);
|
||||
if (args[2] === 'true') {
|
||||
if (client.global.db.guilds[message.guild.id].permissions === false) {
|
||||
if (!client.global.db.guilds[message.guild.id].permissions) {
|
||||
client.global.db.guilds[message.guild.id].permissions = true;
|
||||
message.channel.send(`:white_check_mark: Permissions requirement now set to: \`true\``);
|
||||
} else return message.channel.send(':x: That value is already `true`!');
|
||||
} else if (args[2] === 'false') {
|
||||
if (client.global.db.guilds[message.guild.id].permissions === true) {
|
||||
if (client.global.db.guilds[message.guild.id].permissions) {
|
||||
client.global.db.guilds[message.guild.id].permissions = false;
|
||||
message.channel.send(`:white_check_mark: Permissions requirement now set to: \`false\``);
|
||||
} else return message.channel.send(':x: That value is already `false`!');
|
||||
} else return message.channel.send(':x: Please define a boolean! (true/false)');
|
||||
} else if (args[1] === 'setPremium' && message.author.id === '360363051792203779') {
|
||||
} else if (args[1] === 'setpremium' && message.author.id === '360363051792203779') {
|
||||
if (args[2]) {
|
||||
const guild = client.guilds.get(args[2]);
|
||||
if (!client.global.db.guilds[guild.id].premium) {
|
||||
@ -60,12 +60,36 @@ module.exports = {
|
||||
message.channel.send(":white_check_mark: This guild is no longer premium!")
|
||||
}
|
||||
}
|
||||
} else if (args[1] === "setdj") {
|
||||
if (!client.global.db.guilds[message.guild.id].dj) {
|
||||
if (!client.global.db.guilds[message.guild.id].permissions) {
|
||||
client.global.db.guilds[message.guild.id].permissions = true;
|
||||
}
|
||||
client.global.db.guilds[message.guild.id].dj = true;
|
||||
if (message.guild.roles.find(x => x.name === "DJ")) {
|
||||
client.global.db.guilds[message.guild.id].djrole = message.guild.roles.find(x => x.name === "DJ").id;
|
||||
message.channel.send(':white_check_mark: I found a `DJ` role from this guild! This role is now the DJ role.');
|
||||
} else {
|
||||
const permissions = message.channel.permissionsFor(message.client.user);
|
||||
if (!permissions.has('MANAGE_ROLES')) return message.channel.send(':x: I cannot create roles (Manage roles), make sure I have the proper permissions! I will need this permission to create a `DJ` role since i did not find one!');
|
||||
message.guild.createRole({
|
||||
name: 'DJ',
|
||||
})
|
||||
.then(role => client.global.db.guilds[message.guild.id].djrole = role.id)
|
||||
.catch(console.error)
|
||||
message.channel.send(':white_check_mark: I did not find a role `DJ` so i have created one for you!');
|
||||
}
|
||||
} else {
|
||||
client.global.db.guilds[message.guild.id].dj = false;
|
||||
message.channel.send(':white_check_mark: `DJ` now set to `false`');
|
||||
}
|
||||
} else {
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setTitle('Guild settings for Musix')
|
||||
.addField('prefix', 'Change the guild specific prefix.', true)
|
||||
.addField('volume', 'Change the default volume that the bot will start playing at.', true)
|
||||
.addField('permissions', 'Change whether to require permissions to use eg `skip, stop, pause, loop, etc...`')
|
||||
.addField('permissions', 'Change whether to require permissions to use eg `skip, stop, pause, loop, etc...`', true)
|
||||
.addField('setdj', 'Set a DJ role. This will allow chosen users to freely use all Musix commands. This will automatically set the `permissions` settings to true in order for the `DJ` role to have effect!', true)
|
||||
.setFooter(`how to use: ${prefix}settings <Setting name> <value>`)
|
||||
.setAuthor(client.user.username, client.user.displayAvatarURL)
|
||||
.setColor('#b50002')
|
||||
|
@ -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 skip the song!');
|
||||
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 skip songs!');
|
||||
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 skip songs!');
|
||||
} else if (!permissions.has('MANAGE_MESSAGES')) return message.channel.send(':x: You need the `MANAGE_MESSAGES` permission to skip songs!');
|
||||
}
|
||||
}
|
||||
message.channel.send(':fast_forward: Skipped the song!');
|
||||
|
@ -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 stop the music!');
|
||||
if (client.global.db.guilds[message.guild.id].permissions === true) {
|
||||
if (!permissions.has('MANAGE_CHANNELS')) return message.channel.send(':x: You need the `MANAGE_CHANNELS` permission to stop 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 stop the music!');
|
||||
} else if (!permissions.has('MANAGE_CHANNELS')) return message.channel.send(':x: You need the `MANAGE_CHANNELS` permission to stop the music!');
|
||||
}
|
||||
}
|
||||
serverQueue.songs = [];
|
||||
|
@ -12,7 +12,9 @@ module.exports = {
|
||||
if (message.author.id !== '360363051792203779') {
|
||||
if (!voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in a voice channel to change the volume!');
|
||||
if (client.global.db.guilds[message.guild.id].permissions === true) {
|
||||
if (!permissions.has('MANAGE_CHANNELS')) return message.channel.send(':x: You need the `MANAGE_CHANNELS` permission to change the volume!');
|
||||
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 change the volume!');
|
||||
} else if (!permissions.has('MANAGE_CHANNELS')) return message.channel.send(':x: You need the `MANAGE_CHANNELS` permission to change the volume!');
|
||||
}
|
||||
if (isNaN(args[1])) return message.channel.send(':x: I\'m sorry, But you need to enter a valid __number__.');
|
||||
if (args[1] > 100) return message.channel.send(':x: The max volume is `100`!');
|
||||
|
@ -6,12 +6,16 @@ module.exports = {
|
||||
defaultVolume: 5,
|
||||
permissions: false,
|
||||
premium: false,
|
||||
dj: false,
|
||||
djrole: null
|
||||
});
|
||||
client.global.db.guilds[guild.id] = {
|
||||
prefix: ">",
|
||||
defaultVolume: 5,
|
||||
permissions: false,
|
||||
premium: false,
|
||||
dj: false,
|
||||
djrole: null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ module.exports = {
|
||||
defaultVolume: 5,
|
||||
permissions: false,
|
||||
premium: false,
|
||||
dj: false,
|
||||
djrole: null
|
||||
};
|
||||
});
|
||||
return message.channel.send(':white_check_mark: Reset all guild settings!')
|
||||
@ -18,6 +20,8 @@ module.exports = {
|
||||
defaultVolume: 5,
|
||||
permissions: false,
|
||||
premium: false,
|
||||
dj: false,
|
||||
djrole: null
|
||||
};
|
||||
}
|
||||
let prefix = client.global.db.guilds[message.guild.id].prefix;
|
||||
|
@ -20,6 +20,8 @@ module.exports = {
|
||||
defaultVolume: client.global.db.guilds[guild.id].defaultVolume,
|
||||
permissions: client.global.db.guilds[guild.id].permissions,
|
||||
premium: client.global.db.guilds[guild.id].premium,
|
||||
dj: client.global.db.guilds[guild.id].dj,
|
||||
djrole: client.global.db.guilds[guild.id].djrole,
|
||||
});
|
||||
if (client.global.db.guilds[guild.id].premium) {
|
||||
client.db.collection('playlists').doc(guild.id).set({
|
||||
|
Loading…
Reference in New Issue
Block a user