Finally decided on a help command I like
This commit is contained in:
parent
aedce9fc34
commit
bfde321b3e
10 changed files with 90 additions and 70 deletions
|
@ -11,7 +11,7 @@ exports.help = {
|
|||
name: 'help',
|
||||
category: 'Bot',
|
||||
description: 'Lists all commands Woomy has, what they do, and how to use them.',
|
||||
usage: '`help` - Lists all commands.\n`help <command>` - Show detailed information on how to use the specified command.',
|
||||
usage: '`help` - Shows the embed that provides info on how to use woomy. `help all` - Lists all commands.\n`help <command>` - Show detailed information on how to use the specified command.',
|
||||
parameters: '`command` - The name of the command you want more information on.'
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,19 @@ exports.run = (client, message, args, level, data) => {
|
|||
const embed = new Discord.MessageEmbed()
|
||||
embed.setColor(client.embedColour(message.guild))
|
||||
|
||||
const commands = client.commands
|
||||
const categories = []
|
||||
|
||||
commands.forEach((cmd) => {
|
||||
if (!categories.includes(cmd.help.category)) {
|
||||
if (cmd.help.category === 'Developer' && !client.config.devs.includes('message.author.id')) {
|
||||
return
|
||||
}
|
||||
categories.push(cmd.help.category)
|
||||
}
|
||||
})
|
||||
|
||||
if (!args[0]) {
|
||||
const categories = []
|
||||
let uPrefix = '`' + data.user.prefix + '`'
|
||||
let gPrefix = '`' + data.guild.prefix + '`'
|
||||
|
||||
|
@ -33,32 +44,31 @@ exports.run = (client, message, args, level, data) => {
|
|||
gPrefix = 'None set, use: `~prefix`'
|
||||
}
|
||||
|
||||
embed.setTitle('Woomy Help')
|
||||
embed.setDescription(`**Prefixes**\n» Default: \`${client.config.defaultPrefix}\`\n» Server: ${gPrefix}\n» Personal: ${uPrefix}\n\n» [Join my discord server](https://discord.gg/HCF8mdv) if you need help!\n» Use \`help <command>\` to recieve more information about a command!`)
|
||||
const commands = client.commands
|
||||
|
||||
commands.forEach((cmd) => {
|
||||
if (!categories.includes(cmd.help.category)) {
|
||||
if (cmd.help.category === 'Developer' && !client.config.devs.includes('message.author.id')) {
|
||||
return
|
||||
}
|
||||
categories.push(cmd.help.category)
|
||||
}
|
||||
})
|
||||
embed.setTitle('Help & Commands')
|
||||
embed.setDescription('')
|
||||
if (client.version.news.length > 0) {
|
||||
embed.addField('**News**', client.version.news)
|
||||
}
|
||||
embed.addField('**Prefixes**', `Default Prefix: \`${client.config.defaultPrefix}\`\nServer Prefix: ${gPrefix}\nUser Prefix: ${uPrefix}`)
|
||||
embed.addField('**Command Syntax**', 'For arguments in commands:\n» Arguments in `[]` brackets are required.\n» Arguments in `<>` brackets are optional.\n» Arguments prefixed with `-` are flags, and are placed at the start of the command (`avatar -jpg mudkipscience`)')
|
||||
embed.addField('**Commands**', `Use \`${message.prefix}help all\` to view all commands, or \`${message.prefix}help <command>\` for more information on a specific command.\n\n[Bot Invite](https://discordapp.com/oauth2/authorize?client_id=${client.user.id}&permissions=2134240503&scope=bot) | [Discord Server](https://discord.gg/HCF8mdv) | [GitHub](https://github.com/mudkipscience/woomy) | [Vote for me!](https://top.gg/bot/435961704145485835/vote)`)
|
||||
|
||||
return message.channel.send(embed)
|
||||
} else if (args[0] === 'all') {
|
||||
embed.setTitle('Commands')
|
||||
categories.sort().forEach((cat) => {
|
||||
const filtered = commands.filter((cmd) => cmd.help.category === cat)
|
||||
embed.addField('**' + cat + '**', filtered.map((cmd) => '`' + cmd.help.name + '`').join(', '), true)
|
||||
embed.addField('**' + cat + '**', filtered.map((cmd) => '`' + cmd.help.name + '`').join(', '))
|
||||
})
|
||||
|
||||
if (message.guild && data.guild.customCommands.length > 0) {
|
||||
embed.addField('**Custom**', data.guild.customCommands.map((cmd) => '`' + cmd.name + '`').join(' '), true)
|
||||
embed.addField('**Custom**', data.guild.customCommands.map((cmd) => '`' + cmd.name + '`').join(' '))
|
||||
}
|
||||
|
||||
return message.channel.send(embed)
|
||||
} else {
|
||||
const command = args.shift().toLowerCase()
|
||||
const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command))
|
||||
const cmd = commands.get(command) || commands.get(client.aliases.get(command))
|
||||
if (!cmd) {
|
||||
return message.channel.send('Command/alias doesn\'t exist')
|
||||
}
|
||||
|
@ -72,12 +82,12 @@ exports.run = (client, message, args, level, data) => {
|
|||
embed.setTitle(cmd.help.category.toLowerCase() + ':' + cmd.help.name)
|
||||
embed.setDescription(cmd.help.description)
|
||||
embed.addField('**Usage**', cmd.help.usage)
|
||||
if (aliases) {
|
||||
embed.addField('**Aliases**', aliases)
|
||||
}
|
||||
if (cmd.help.parameters.length > 0) {
|
||||
embed.addField('**Parameters**', cmd.help.parameters)
|
||||
}
|
||||
if (aliases) {
|
||||
embed.addField('**Aliases**', aliases)
|
||||
}
|
||||
embed.addField('**Rank required**', cmd.conf.permLevel, true)
|
||||
embed.addField('**Server only**', cmd.conf.guildOnly, true)
|
||||
embed.addField('**Cooldown**', cmd.conf.cooldown / 1000 + ' seconds', true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue