1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-14 03:30:18 +00:00
musix-oss/commands/settings/setDj.js

28 lines
1.3 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-03-12 11:56:31 +00:00
msg.channel.send(client.messages.djRoleFound);
2020-02-05 20:02:53 +00:00
client.global.db.guilds[msg.guild.id].dj = true;
} else {
const permissions = msg.channel.permissionsFor(msg.client.user);
2020-03-12 11:56:31 +00:00
if (!permissions.has('MANAGE_ROLES')) return msg.channel.send(client.messages.noPermsManageRoles);
2020-02-05 20:02:53 +00:00
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;
2020-03-12 11:56:31 +00:00
msg.channel.send(client.messages.djRoleCreated);
2020-02-05 20:02:53 +00:00
}
} else {
client.global.db.guilds[msg.guild.id].dj = false;
2020-03-12 11:56:31 +00:00
msg.channel.send(client.messages.djFalse);
2020-02-05 20:02:53 +00:00
}
}
};