2020-03-02 19:38:42 +00:00
module . exports = {
name : 'help' ,
alias : 'h' ,
usage : '<command(opt)>' ,
description : 'See the help for RadioX.' ,
permission : 'none' ,
category : 'info' ,
2020-03-22 15:10:46 +00:00
execute ( msg , args , client , Discord , command ) {
2020-03-12 22:53:23 +00:00
let message = { } ;
2020-03-22 15:10:46 +00:00
2020-03-02 19:38:42 +00:00
if ( args [ 1 ] ) {
2020-03-08 14:22:00 +00:00
if ( ! client . commands . has ( args [ 1 ] ) || ( client . commands . has ( args [ 1 ] ) && client . commands . get ( args [ 1 ] ) . omitFromHelp === true ) ) return msg . channel . send ( 'That command does not exist' ) ;
2020-03-02 19:38:42 +00:00
const command = client . commands . get ( args [ 1 ] ) ;
2020-03-22 15:10:46 +00:00
2020-03-12 22:53:23 +00:00
message . helpCommandTitle = client . messages . helpCommandTitle . replace ( "%client.config.prefix%" , client . config . prefix ) ;
message . helpCommandTitle = message . helpCommandTitle . replace ( "%command.name%" , command . name ) ;
message . helpCommandTitle = message . helpCommandTitle . replace ( "%command.usage%" , command . usage ) ;
2020-03-15 01:30:15 +00:00
message . helpCommandDescription = client . messages . helpCommandDescription . replace ( "%command.description%" , command . description ) ;
2020-03-12 22:53:23 +00:00
message . helpCommandDescription = message . helpCommandDescription . replace ( "%command.alias%" , command . alias ) ;
2020-03-22 15:10:46 +00:00
2020-03-02 19:38:42 +00:00
const embed = new Discord . MessageEmbed ( )
2020-03-12 22:53:23 +00:00
. setTitle ( message . helpCommandTitle )
2020-03-28 00:01:12 +00:00
. setThumbnail ( "https://cdn.discordapp.com/emojis/" + client . messageEmojis [ "logo" ] . replace ( /[^0-9]+/g , '' ) )
2020-03-02 19:38:42 +00:00
. setColor ( client . config . embedColor )
2020-03-12 22:53:23 +00:00
. setDescription ( message . helpCommandDescription )
2020-03-28 00:01:12 +00:00
. setFooter ( 'EximiaBots by Warén Media' , "https://cdn.discordapp.com/emojis/" + client . messageEmojis [ "eximiabots" ] . replace ( /[^0-9]+/g , '' ) ) ;
2020-03-02 19:38:42 +00:00
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-08 14:22:00 +00:00
commands += ` **» ${ categories [ i ] . toUpperCase ( ) } ** \n ${ client . commands . filter ( x => x . category === categories [ i ] && ! x . omitFromHelp ) . map ( x => ` \` ${ x . name } \` ` ) . join ( ', ' ) } \n ` ;
2020-03-02 19:38:42 +00:00
}
2020-03-22 15:10:46 +00:00
2020-03-12 22:53:23 +00:00
message . helpTitle = client . messages . helpTitle . replace ( "%client.user.username%" , client . user . username ) ;
message . helpDescription = client . messages . helpDescription . replace ( "%commands%" , commands ) ;
message . helpDescription = message . helpDescription . replace ( "%client.config.prefix%" , client . config . prefix ) ;
2020-03-22 15:10:46 +00:00
2020-03-02 19:38:42 +00:00
const embed = new Discord . MessageEmbed ( )
2020-03-12 22:53:23 +00:00
. setTitle ( message . helpTitle )
2020-03-28 00:01:12 +00:00
. setThumbnail ( "https://cdn.discordapp.com/emojis/" + client . messageEmojis [ "logo" ] . replace ( /[^0-9]+/g , '' ) )
2020-03-02 19:38:42 +00:00
. setColor ( client . config . embedColor )
2020-03-12 22:53:23 +00:00
. setDescription ( message . helpDescription )
2020-03-28 00:01:12 +00:00
. setFooter ( 'EximiaBots by Warén Media' , "https://cdn.discordapp.com/emojis/" + client . messageEmojis [ "eximiabots" ] . replace ( /[^0-9]+/g , '' ) ) ;
2020-03-02 19:38:42 +00:00
msg . channel . send ( embed ) ;
}
}
} ;