1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 08:10:18 +00:00
musix-oss/commands/settings.js

47 lines
3.0 KiB
JavaScript
Raw Normal View History

module.exports = {
name: 'settings',
usage: '[setting]',
description: 'Change the settings',
2019-09-15 06:18:33 +00:00
cooldown: 10,
2019-10-10 13:43:04 +00:00
async execute(message, args, client, Discord, prefix) {
const permissions = message.channel.permissionsFor(message.author);
if (message.author.id !== '360363051792203779') {
if (!permissions.has('MANAGE_GUILD')) return message.channel.send(':x: You need the `MANAGE_SERVER` permission to change the settings!');
}
2019-09-15 06:18:33 +00:00
if (args[1] === 'prefix') {
2019-10-11 08:48:50 +00:00
if (!args[2]) return message.channel.send(`<:thonk:461691390972264449> Current prefix: \`${client.global.db.guilds[message.guild.id].prefix}\``);
client.global.db.guilds[message.guild.id].prefix = args[2];
2019-10-10 13:43:04 +00:00
message.channel.send(`:white_check_mark: New prefix set to: \`${args[2]}\``);
} else if (args[1] === 'volume') {
2019-10-11 08:48:50 +00:00
if (!args[2]) return message.channel.send(`:speaker: Current default volume is: \`${client.global.db.guilds[message.guild.id].defaultVolume}\``);
2019-10-10 13:43:04 +00:00
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.');
2019-10-11 08:48:50 +00:00
client.global.db.guilds[message.guild.id].defaultVolume = args[2];
2019-10-10 13:43:04 +00:00
message.channel.send(`:white_check_mark: Default volume set to: \`${args[2]}\``);
} else if (args[1] === 'permissions') {
2019-10-11 08:48:50 +00:00
if (!args[2]) return message.channel.send(`🔒 Permission requirement: \`${client.global.db.guilds[message.guild.id].permissions}\``);
2019-10-10 13:43:04 +00:00
if (args[2] === 'true') {
2019-10-11 08:48:50 +00:00
if (client.global.db.guilds[message.guild.id].permissions === false) {
client.global.db.guilds[message.guild.id].permissions = true;
2019-10-10 13:43:04 +00:00
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') {
2019-10-11 08:48:50 +00:00
if (client.global.db.guilds[message.guild.id].permissions === true) {
client.global.db.guilds[message.guild.id].permissions = false;
2019-10-10 13:43:04 +00:00
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)');
2019-09-15 06:18:33 +00:00
} else {
2019-10-10 13:43:04 +00:00
const embed = new Discord.RichEmbed()
.setTitle('Guild settings for Musix')
.addField('prefix', 'Change the guild specific prefix.', true)
2019-10-10 13:43:04 +00:00
.addField('volume', 'Change the default volume that the bot will start playing at.', true)
.addField('permissions', 'Change whether to require permissions to use eg `skip, stop, pause, loop, etc...`')
.setFooter(`how to use: ${prefix}settings <Setting name> <value>`)
.setAuthor(client.user.username, client.user.displayAvatarURL)
.setColor('#b50002')
return message.channel.send(embed);
}
},
2019-10-10 13:43:04 +00:00
};