1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 13:03:18 +00:00
musix-oss/commands/settings/setDj.js
MatteZ02 a64f9d2325 Update 3.0.3
All messages reworked.
2020-03-12 13:56:31 +02:00

28 lines
1.3 KiB
JavaScript

module.exports = {
name: 'setdj',
async execute(msg, args, client, Discord, prefix) {
if (!client.global.db.guilds[msg.guild.id].dj) {
if (!client.global.db.guilds[msg.guild.id].permissions) {
client.global.db.guilds[msg.guild.id].permissions = true;
}
if (msg.guild.roles.cache.find(x => x.name === "DJ")) {
client.global.db.guilds[msg.guild.id].djrole = msg.guild.roles.cache.find(x => x.name === "DJ").id;
msg.channel.send(client.messages.djRoleFound);
client.global.db.guilds[msg.guild.id].dj = true;
} else {
const permissions = msg.channel.permissionsFor(msg.client.user);
if (!permissions.has('MANAGE_ROLES')) return msg.channel.send(client.messages.noPermsManageRoles);
msg.guild.createRole({
name: 'DJ',
})
.then(role => client.global.db.guilds[msg.guild.id].djrole = role.id)
.catch(console.error)
client.global.db.guilds[msg.guild.id].dj = true;
msg.channel.send(client.messages.djRoleCreated);
}
} else {
client.global.db.guilds[msg.guild.id].dj = false;
msg.channel.send(client.messages.djFalse);
}
}
};