2019-08-14 12:26:33 +00:00
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 ) {
2019-08-14 12:26:33 +00:00
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-10 13:43:04 +00:00
if ( ! args [ 2 ] ) return message . channel . send ( ` <:thonk:461691390972264449> Current prefix: \` ${ client . global . db . musix _guilds [ message . guild . id ] . musix _prefix } \` ` ) ;
client . global . db . musix _guilds [ message . guild . id ] . musix _prefix = args [ 2 ] ;
message . channel . send ( ` :white_check_mark: New prefix set to: \` ${ args [ 2 ] } \` ` ) ;
} else if ( args [ 1 ] === 'volume' ) {
if ( ! args [ 2 ] ) return message . channel . send ( ` :speaker: Current default volume is: \` ${ client . global . db . musix _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 . musix _guilds [ message . guild . id ] . defaultVolume = args [ 2 ] ;
message . channel . send ( ` :white_check_mark: Default volume set to: \` ${ args [ 2 ] } \` ` ) ;
} else if ( args [ 1 ] === 'permissions' ) {
if ( ! args [ 2 ] ) return message . channel . send ( ` 🔒 Permission requirement: \` ${ client . global . db . musix _guilds [ message . guild . id ] . permissions } \` ` ) ;
if ( args [ 2 ] === 'true' ) {
if ( client . global . db . musix _guilds [ message . guild . id ] . permissions === false ) {
client . global . db . musix _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 . musix _guilds [ message . guild . id ] . permissions === true ) {
client . global . db . musix _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)' ) ;
2019-09-15 06:18:33 +00:00
} else {
2019-10-10 13:43:04 +00:00
const embed = new Discord . RichEmbed ( )
2019-08-14 12:26:33 +00:00
. 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...`' )
2019-08-14 12:26:33 +00:00
. 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
} ;