mirror of
https://github.com/musix-org/musix-oss
synced 2025-08-01 17:44:35 +00:00
Option handler for playlists and settings. Exe function to execute command files. Command aliases updated.
This commit is contained in:
12
commands/settings/announcesongs.js
Normal file
12
commands/settings/announcesongs.js
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = {
|
||||
name: 'announcesongs',
|
||||
async execute(message, args, client, Discord, prefix) {
|
||||
if (client.global.db.guilds[message.guild.id].startPlaying) {
|
||||
client.global.db.guilds[message.guild.id].startPlaying = false;
|
||||
return message.channel.send(':white_check_mark: announcesongs now set to `false`!');
|
||||
} else {
|
||||
client.global.db.guilds[message.guild.id].startPlaying = true;
|
||||
return message.channel.send(':white_check_mark: announcesongs now set to `true`!');
|
||||
}
|
||||
}
|
||||
};
|
17
commands/settings/permissions.js
Normal file
17
commands/settings/permissions.js
Normal file
@@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
name: 'permissions',
|
||||
async execute(message, args, client, Discord, prefix) {
|
||||
if (!args[2]) return message.channel.send(`🔒 Permission requirement: \`${client.global.db.guilds[message.guild.id].permissions}\``);
|
||||
if (args[2] === 'true') {
|
||||
if (!client.global.db.guilds[message.guild.id].permissions) {
|
||||
client.global.db.guilds[message.guild.id].permissions = true;
|
||||
message.channel.send(`:white_check_mark: Permissions requirement now set to: \`true\``);
|
||||
} else return message.channel.send(':x: That value is already `true`!');
|
||||
} else if (args[2] === 'false') {
|
||||
if (client.global.db.guilds[message.guild.id].permissions) {
|
||||
client.global.db.guilds[message.guild.id].permissions = false;
|
||||
message.channel.send(`:white_check_mark: Permissions requirement now set to: \`false\``);
|
||||
} else return message.channel.send(':x: That value is already `false`!');
|
||||
} else return message.channel.send(':x: Please define a boolean! (true/false)');
|
||||
}
|
||||
};
|
8
commands/settings/prefix.js
Normal file
8
commands/settings/prefix.js
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
name: 'prefix',
|
||||
async execute(message, args, client, Discord, prefix) {
|
||||
if (!args[2]) return message.channel.send(`Current prefix: \`${client.global.db.guilds[message.guild.id].prefix}\``);
|
||||
client.global.db.guilds[message.guild.id].prefix = args[2];
|
||||
message.channel.send(`:white_check_mark: New prefix set to: \`${args[2]}\``);
|
||||
}
|
||||
};
|
27
commands/settings/setDj.js
Normal file
27
commands/settings/setDj.js
Normal file
@@ -0,0 +1,27 @@
|
||||
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`');
|
||||
}
|
||||
}
|
||||
};
|
34
commands/settings/setpremium.js
Normal file
34
commands/settings/setpremium.js
Normal file
@@ -0,0 +1,34 @@
|
||||
module.exports = {
|
||||
name: 'setpremium',
|
||||
async execute(message, args, client, Discord, prefix) {
|
||||
if (message.author.id !== client.config.devId) return;
|
||||
if (args[2]) {
|
||||
const guild = client.guilds.get(args[2]);
|
||||
if (!client.global.db.guilds[guild.id].premium) {
|
||||
client.global.db.playlists[guild.id] = {
|
||||
songs: [],
|
||||
firstSong: undefined,
|
||||
saved: false,
|
||||
};
|
||||
client.global.db.guilds[guild.id].premium = true;
|
||||
message.channel.send(`:white_check_mark: Guild ${guild.name} | ${guild.id} is now premium! :tada:`)
|
||||
} else {
|
||||
client.global.db.guilds[guild.id].premium = false;
|
||||
message.channel.send(`:white_check_mark: Guild ${guild.name} | ${guild.id} is no longer premium!`)
|
||||
}
|
||||
} else {
|
||||
if (!client.global.db.guilds[message.guild.id].premium) {
|
||||
client.global.db.playlists[message.guild.id] = {
|
||||
songs: [],
|
||||
firstSong: undefined,
|
||||
saved: false,
|
||||
};
|
||||
client.global.db.guilds[message.guild.id].premium = true;
|
||||
message.channel.send(':white_check_mark: This guild is now premium! :tada:')
|
||||
} else {
|
||||
client.global.db.guilds[message.guild.id].premium = false;
|
||||
message.channel.send(":white_check_mark: This guild is no longer premium!")
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
10
commands/settings/volume.js
Normal file
10
commands/settings/volume.js
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
name: 'volume',
|
||||
async execute(message, args, client, Discord, prefix) {
|
||||
if (!args[2]) return message.channel.send(`:speaker: Current default volume is: \`${client.global.db.guilds[message.guild.id].defaultVolume}\``);
|
||||
if (isNaN(args[2])) return message.channel.send(':x: I\'m sorry, But the default volume needs to be a valid __number__.');
|
||||
if (args[2].length > 2) return message.channel.send(':x: The default volume must be below `100` for quality and safety resons.');
|
||||
client.global.db.guilds[message.guild.id].defaultVolume = args[2];
|
||||
message.channel.send(`:white_check_mark: Default volume set to: \`${args[2]}\``);
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user