2020-04-06 05:54:45 +00:00
exports . conf = {
enabled : true ,
guildOnly : false ,
2020-04-06 16:35:06 +00:00
aliases : [ 'commands' , 'cmds' , 'halp' ] ,
2020-04-06 05:54:45 +00:00
permLevel : 'User' ,
requiredPerms : [ 'EMBED_LINKS' ] ,
cooldown : 2000
}
exports . help = {
name : 'help' ,
category : 'General' ,
2020-04-06 16:35:06 +00:00
description : 'Sends you a list of Woomy\'s commands.' ,
2020-04-08 14:09:55 +00:00
usage : '`help` - Lists all commands.\n`help <command>` - Receive more information on a command.' ,
examples : '`help`\n`help roleinfo`'
2020-04-06 05:54:45 +00:00
}
const Discord = require ( 'discord.js' )
exports . run = ( client , message , args , level , data ) => {
const embed = new Discord . MessageEmbed ( )
embed . setColor ( client . embedColour ( message . guild ) )
2020-04-06 09:36:32 +00:00
2020-04-06 16:35:06 +00:00
const prefixes = [ data . user . prefix ]
if ( message . guild && data . user . prefix !== data . guild . prefix ) {
prefixes . push ( data . guild . prefix )
2020-04-06 09:36:32 +00:00
}
prefixes . push ( '@Woomy' )
const categories = [ ]
if ( ! args [ 0 ] ) {
2020-04-08 14:09:55 +00:00
embed . setTitle ( 'Woomy Commands' )
embed . setDescription ( ` • Prefixes: ${ '`' + prefixes . join ( '`, `' ) + '`' } \n • Use \` help <command> \` to recieve more information about a command! \n • [Join my support server](https://discord.gg/HCF8mdv) ` )
2020-04-06 09:36:32 +00:00
const commands = client . commands
commands . forEach ( ( cmd ) => {
if ( ! categories . includes ( cmd . help . category ) ) {
2020-04-08 14:09:55 +00:00
if ( cmd . help . category === 'Developer' && ! client . config . devs . includes ( 'message.author.id' ) ) {
return
}
2020-04-06 09:36:32 +00:00
categories . push ( cmd . help . category )
}
} )
categories . sort ( ) . forEach ( ( cat ) => {
const filtered = commands . filter ( ( cmd ) => cmd . help . category === cat )
2020-04-08 14:09:55 +00:00
embed . addField ( cat , filtered . map ( ( cmd ) => '`' + cmd . help . name + '`' ) . join ( ', ' ) )
2020-04-06 09:36:32 +00:00
} )
2020-04-06 16:35:06 +00:00
if ( message . guild && data . guild . customCommands . length > 0 ) {
embed . addField ( 'Custom' , data . guild . customCommands . map ( ( cmd ) => '`' + cmd . name + '`' ) . join ( ' ' ) )
2020-04-06 09:36:32 +00:00
}
2020-04-08 14:09:55 +00:00
embed . addField ( 'Invite' , '[Invite](https://discordapp.com/oauth2/authorize?client_id=435961704145485835&permissions=8&scope=bot) | [Discord Server](https://discord.gg/HCF8mdv)' )
2020-04-06 09:36:32 +00:00
return message . channel . send ( embed )
2020-04-08 14:09:55 +00:00
} else {
2020-04-06 16:35:06 +00:00
const command = args . shift ( ) . toLowerCase ( )
const cmd = client . commands . get ( command ) || client . commands . get ( client . aliases . get ( command ) )
if ( ! cmd ) {
return message . channel . send ( 'Command/alias doesn\'t exist' )
}
2020-04-08 14:09:55 +00:00
let desc = ''
2020-04-06 16:35:06 +00:00
if ( cmd . conf . aliases . length > 0 ) {
2020-04-08 14:09:55 +00:00
desc += ` *(Aliases: ${ cmd . conf . aliases . join ( ', ' ) } )* \n \n `
2020-04-06 16:35:06 +00:00
}
2020-04-08 14:09:55 +00:00
desc += cmd . help . description + ` \n \n **You need the \` ${ cmd . conf . permLevel } \` rank to run this command! This command has a cooldown of \` ${ cmd . conf . cooldown / 1000 } \` seconds per user.** `
2020-04-08 09:30:17 +00:00
embed . setTitle ( cmd . help . category . toLowerCase ( ) + ':' + cmd . help . name )
2020-04-08 14:09:55 +00:00
embed . setDescription ( desc )
embed . addField ( '**Usage**' , cmd . help . usage )
if ( cmd . help . examples . length > 0 ) {
embed . addField ( '**Examples**' , cmd . help . examples )
2020-04-06 16:35:06 +00:00
}
embed . setFooter ( '< > = optional, [ ] = required. Don\'t include the brackets in the command itself!' )
message . channel . send ( embed )
2020-04-06 09:36:32 +00:00
}
2020-04-06 05:54:45 +00:00
}