2019-08-14 12:26:33 +00:00
module . exports = {
name : 'settings' ,
usage : '[setting]' ,
description : 'Change the settings' ,
2019-10-31 18:29:26 +00:00
alias : 'settings' ,
2019-09-15 06:18:33 +00:00
cooldown : 10 ,
2019-11-01 11:39:04 +00:00
onlyDev : false ,
2019-10-10 13:43:04 +00:00
async execute ( message , args , client , Discord , prefix ) {
2019-10-31 18:29:26 +00:00
const embed = new Discord . RichEmbed ( )
. setTitle ( 'Guild settings for Musix' )
. addField ( 'prefix' , 'Change the guild specific prefix. (string)' , true )
. addField ( 'volume' , 'Change the default volume that the bot will start playing at. (number)' , true )
. addField ( 'permissions' , 'Change whether to require permissions to use eg `skip, stop, pause, loop, etc...`' , true )
. addField ( 'setdj' , 'Set a DJ role. This will allow chosen users to freely use all Musix commands. This will automatically set the `permissions` settings to true in order for the `DJ` role to have effect!' , true )
. addField ( 'announcesongs' , 'Whether to announce songs that start playing or not.' )
2019-11-14 18:23:51 +00:00
. addField ( 'songselection' , 'Will i ask to select a song from the top 10 queries or start playing the first result instantly.' )
2019-10-31 18:29:26 +00:00
. setFooter ( ` how to use: ${ prefix } settings <Setting name> <value> ` )
. setAuthor ( client . user . username , client . user . displayAvatarURL )
2019-12-05 13:17:15 +00:00
. setColor ( client . embedColor )
2019-08-14 12:26:33 +00:00
const permissions = message . channel . permissionsFor ( message . author ) ;
2019-11-23 13:03:08 +00:00
if ( message . author . id !== client . config . devId ) {
2019-08-14 12:26:33 +00:00
if ( ! permissions . has ( 'MANAGE_GUILD' ) ) return message . channel . send ( ':x: You need the `MANAGE_SERVER` permission to change the settings!' ) ;
}
2019-10-31 18:29:26 +00:00
if ( args [ 1 ] ) {
const optionName = args [ 1 ] . toLowerCase ( ) ;
const option = client . settingCmd . get ( optionName ) || client . settingCmd . find ( cmd => cmd . aliases && cmd . aliases . includes ( optionName ) ) ;
if ( ! option ) return message . channel . send ( embed ) ;
try {
option . execute ( message , args , client , Discord , prefix ) ;
} catch ( error ) {
message . reply ( ` :x: there was an error trying to execute that option! Please contact support with \` ${ prefix } bug \` ! ` ) ;
const embed = new Discord . RichEmbed ( )
. setTitle ( ` Musix ${ error . toString ( ) } ` )
. setDescription ( error . stack . replace ( /at /g , '**at **' ) )
2019-12-05 13:17:15 +00:00
. setColor ( client . config . embedColor ) ;
2019-10-31 18:29:26 +00:00
client . fetchUser ( client . config . devId ) . then ( user => user . send ( embed ) ) . catch ( console . error ) ;
2019-10-31 19:10:53 +00:00
client . channels . get ( client . config . debug _channel ) . send ( embed ) ;
2019-10-24 17:21:55 +00:00
}
2019-09-15 06:18:33 +00:00
} else {
2019-08-14 12:26:33 +00:00
return message . channel . send ( embed ) ;
}
} ,
2019-10-10 13:43:04 +00:00
} ;