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

28 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-02-05 20:02:53 +00:00
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;
}
2020-02-19 20:04:06 +00:00
if (msg.guild.roles.cache.find(x => x.name === "DJ")) {
2020-02-19 20:05:21 +00:00
client.global.db.guilds[msg.guild.id].djrole = msg.guild.roles.cache.find(x => x.name === "DJ").id;
2020-02-05 20:02:53 +00:00
msg.channel.send('<:green_check_mark:674265384777416705> I found a `DJ` role from this guild! This role is now the DJ role.');
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('<:redx:674263474704220182> 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!');
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('<:green_check_mark:674265384777416705> I did not find a role `DJ` so i have created one for you!');
}
} else {
client.global.db.guilds[msg.guild.id].dj = false;
msg.channel.send('<:green_check_mark:674265384777416705> `DJ` now set to `false`');
}
}
};