Did lots of things

This commit is contained in:
Emily 2020-04-11 19:30:51 +10:00
parent 2e85c85d3c
commit ba0448c905
11 changed files with 115 additions and 112 deletions

View file

@ -1,7 +1,7 @@
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ['commands', 'cmds', 'halp'],
aliases: ['commands', 'cmds'],
permLevel: 'User',
requiredPerms: ['EMBED_LINKS'],
cooldown: 2000
@ -9,10 +9,10 @@ exports.conf = {
exports.help = {
name: 'help',
category: 'General',
description: 'Sends you a list of Woomy\'s commands.',
usage: '`help` - Lists all commands.\n`help <command>` - Receive more information on a command.',
examples: '`help`\n`help roleinfo`'
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.',
parameters: '`command` - The name of the command you want more information on.'
}
const Discord = require('discord.js')
@ -20,17 +20,21 @@ exports.run = (client, message, args, level, data) => {
const embed = new Discord.MessageEmbed()
embed.setColor(client.embedColour(message.guild))
const prefixes = [data.user.prefix]
if (message.guild && data.user.prefix !== data.guild.prefix) {
prefixes.push(data.guild.prefix)
}
prefixes.push('@Woomy')
const categories = []
if (!args[0]) {
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)`)
const categories = []
let uPrefix = '`' + data.user.prefix + '`'
let gPrefix = '`' + data.guild.prefix + '`'
if (client.config.defaultPrefix === data.user.prefix) {
uPrefix = 'None set, use: `~myprefix'
}
if (client.config.defaultPrefix === data.guild.prefix) {
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) => {
@ -44,14 +48,13 @@ exports.run = (client, message, args, level, data) => {
categories.sort().forEach((cat) => {
const filtered = commands.filter((cmd) => cmd.help.category === cat)
embed.addField(cat, filtered.map((cmd) => '`' + cmd.help.name + '`').join(', '))
embed.addField('**' + cat + '**', filtered.map((cmd) => '`' + cmd.help.name + '`').join(', '), true)
})
if (message.guild && data.guild.customCommands.length > 0) {
embed.addField('Custom', data.guild.customCommands.map((cmd) => '`' + cmd.name + '`').join(' '))
embed.addField('**Custom**', data.guild.customCommands.map((cmd) => '`' + cmd.name + '`').join(' '), true)
}
embed.addField('Invite', '[Invite](https://discordapp.com/oauth2/authorize?client_id=435961704145485835&permissions=8&scope=bot) | [Discord Server](https://discord.gg/HCF8mdv)')
return message.channel.send(embed)
} else {
const command = args.shift().toLowerCase()
@ -60,23 +63,24 @@ exports.run = (client, message, args, level, data) => {
return message.channel.send('Command/alias doesn\'t exist')
}
let aliases
let aliases = ''
if (cmd.conf.aliases.length > 0) {
aliases = '`' + cmd.conf.aliases.join('`, `') + '`'
}
const 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.**`
embed.setTitle(cmd.help.category.toLowerCase() + ':' + cmd.help.name)
embed.setDescription(desc)
embed.setDescription(cmd.help.description)
embed.addField('**Usage**', cmd.help.usage)
if (cmd.help.examples.length > 0) {
embed.addField('**Examples**', cmd.help.examples)
}
if (aliases) {
embed.addField('**Aliases**', aliases)
}
if (cmd.help.parameters.length > 0) {
embed.addField('**Parameters**', cmd.help.parameters)
}
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)
embed.setFooter('< > = optional, [ ] = required. Don\'t include the brackets in the command itself!')
message.channel.send(embed)
}