mirror of
https://github.com/musix-org/musix-oss
synced 2024-11-10 05:10:17 +00:00
27 lines
1.6 KiB
JavaScript
27 lines
1.6 KiB
JavaScript
module.exports = {
|
|
name: 'setdj',
|
|
async execute(message, args, client, Discord, prefix) {
|
|
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`');
|
|
}
|
|
}
|
|
}; |