1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 00:23:17 +00:00

Update setDj.js

This commit is contained in:
MatteZ02 2019-11-03 13:55:04 +02:00
parent bc7e31a05f
commit c2490b94ed

View File

@ -5,10 +5,10 @@ module.exports = {
if (!client.global.db.guilds[message.guild.id].permissions) { 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].permissions = true;
} }
client.global.db.guilds[message.guild.id].dj = true;
if (message.guild.roles.find(x => x.name === "DJ")) { 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; 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.'); message.channel.send(':white_check_mark: I found a `DJ` role from this guild! This role is now the DJ role.');
client.global.db.guilds[message.guild.id].dj = true;
} else { } else {
const permissions = message.channel.permissionsFor(message.client.user); 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!'); 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!');
@ -17,6 +17,7 @@ module.exports = {
}) })
.then(role => client.global.db.guilds[message.guild.id].djrole = role.id) .then(role => client.global.db.guilds[message.guild.id].djrole = role.id)
.catch(console.error) .catch(console.error)
client.global.db.guilds[message.guild.id].dj = true;
message.channel.send(':white_check_mark: I did not find a role `DJ` so i have created one for you!'); message.channel.send(':white_check_mark: I did not find a role `DJ` so i have created one for you!');
} }
} else { } else {