2020-02-05 20:02:53 +00:00
module . exports = {
name : 'help' ,
2020-05-15 16:05:39 +00:00
alias : [ "h" ] ,
2020-02-24 18:41:40 +00:00
usage : '<command(opt)>' ,
2020-02-05 20:02:53 +00:00
description : 'See the help for Musix.' ,
onlyDev : false ,
permission : 'none' ,
category : 'info' ,
2020-03-21 17:49:25 +00:00
execute ( msg , args , client , Discord , command ) {
2020-02-05 20:02:53 +00:00
if ( args [ 1 ] ) {
if ( ! client . commands . has ( args [ 1 ] ) || ( client . commands . has ( args [ 1 ] ) && client . commands . get ( args [ 1 ] ) . omitFromHelp === true && msg . guild . id !== '489083836240494593' ) ) return msg . channel . send ( 'That command does not exist' ) ;
const command = client . commands . get ( args [ 1 ] ) ;
const embed = new Discord . MessageEmbed ( )
. setTitle ( ` ${ client . global . db . guilds [ msg . guild . id ] . prefix } ${ command . name } ${ command . usage } ` )
. setDescription ( command . description )
2020-05-15 16:05:39 +00:00
. setFooter ( ` ${ client . messages . helpCmdFooter } \` ${ command . alias . map ( a => ` ${ a } , ` ) } \` ` )
2020-02-05 20:02:53 +00:00
. setColor ( client . config . embedColor )
msg . channel . send ( embed ) ;
} else {
const categories = [ ] ;
for ( let i = 0 ; i < client . commands . size ; i ++ ) {
if ( ! categories . includes ( client . commands . array ( ) [ i ] . category ) ) categories . push ( client . commands . array ( ) [ i ] . category ) ;
}
let commands = '' ;
for ( let i = 0 ; i < categories . length ; i ++ ) {
2020-03-03 20:25:12 +00:00
commands += ` **» ${ categories [ i ] . toUpperCase ( ) } ** \n ${ client . commands . filter ( x => x . category === categories [ i ] && ! x . omitFromHelp && ! x . onlyDev ) . map ( x => ` \` ${ x . name } \` ` ) . join ( ', ' ) } \n ` ;
2020-02-05 20:02:53 +00:00
}
2020-03-13 14:20:23 +00:00
let message ;
2020-03-21 17:49:25 +00:00
message = client . messages . helpFooter . replace ( "%PREFIX%" , client . global . db . guilds [ msg . guild . id ] . prefix ) ;
2020-02-05 20:02:53 +00:00
const embed = new Discord . MessageEmbed ( )
2020-03-13 14:20:23 +00:00
. setTitle ( ` ${ client . user . username } ${ client . messages . helpTitle } ` )
2020-02-05 20:02:53 +00:00
. setDescription ( commands )
2020-03-13 14:20:23 +00:00
. setFooter ( message )
2020-02-05 20:02:53 +00:00
. setColor ( client . config . embedColor )
msg . channel . send ( embed ) ;
}
}
2020-05-15 16:05:39 +00:00
} ;