-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aeristhy
committed
Jun 7, 2021
1 parent
f887ff2
commit a0d4ed3
Showing
11 changed files
with
45 additions
and
31 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,45 @@ | ||
const prefix = '!' | ||
const prefix = '!'; | ||
|
||
module.exports = { | ||
name: 'help', | ||
description: 'List all of my commands or info about a specific command.', | ||
aliases: ['cmd', 'cmds'], | ||
usage: '[command name]', | ||
category: 'Utility', | ||
execute(message, args) { | ||
const data = []; | ||
const { commands } = message.client; | ||
|
||
|
||
if (!args.length) { | ||
data.push('Here\'s a list of all my commands:'); | ||
data.push(commands.map(command => command.name).join(', ')); | ||
data.push(`\nYou can send \`${prefix}help [command name]\` to get info on a specific command!`); | ||
|
||
return message.channel.send(data, { split: true }) | ||
.catch(error => { | ||
message.channel.send('An error has occured!' + error); | ||
}); | ||
} | ||
const name = args[0].toLowerCase(); | ||
const command = commands.get(name) || commands.find(c => c.aliases && c.aliases.includes(name)); | ||
|
||
if (!command) { | ||
return message.reply('that\'s not a valid command!'); | ||
const command = commands || commands.find(c => c.aliases && c.aliases); | ||
let currentCategory = ""; | ||
let output = `**Use ${prefix}help <commandName> for details**`; | ||
const sorted = command.array().sort((p, c) => p.category > c.category ? 1 : p.name > c.name && p.category === c.category ? 1 : -1 ); | ||
|
||
sorted.forEach( c => { | ||
const cat = c.category || "None"; | ||
if (currentCategory !== cat) { | ||
output += `\u200b\n\n**${cat}**\n`; | ||
currentCategory = cat; | ||
} | ||
output += `\`${prefix}${c.name}\` `; | ||
}); | ||
message.channel.send(output); | ||
} else { | ||
const name = args[0].toLowerCase(); | ||
const command = commands.get(name) || commands.find(c => c.aliases && c.aliases.includes(name)); | ||
if (!command) { | ||
return message.channel.send('Command not found.'); | ||
} | ||
|
||
data.push(`**Name:** ${command.name}`); | ||
if (command.aliases) data.push(`**Aliases:** ${command.aliases.join(', ')}`); | ||
if (command.description) data.push(`**Description:** ${command.description}`); | ||
if (command.usage) data.push(`**Usage:** ${prefix}${command.name} ${command.usage}`); | ||
if (command.category) data.push(`**Category:** ${command.category}` || "None"); | ||
data.push(`**Cooldown:** ${command.cooldown || 3} second(s)`); | ||
message.channel.send(data, { split: true }); | ||
} | ||
|
||
data.push(`**Name:** ${command.name}`); | ||
|
||
if (command.aliases) data.push(`**Aliases:** ${command.aliases.join(', ')}`); | ||
if (command.description) data.push(`**Description:** ${command.description}`); | ||
if (command.usage) data.push(`**Usage:** ${prefix}${command.name} ${command.usage}`); | ||
|
||
data.push(`**Cooldown:** ${command.cooldown || 3} second(s)`); | ||
|
||
message.channel.send(data, { split: true }); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters