summaryrefslogtreecommitdiff
path: root/server/src/commands/util/Help.ts
diff options
context:
space:
mode:
author8cy <[email protected]>2020-07-23 23:24:17 -0700
committer8cy <[email protected]>2020-07-23 23:24:17 -0700
commitbb511abc03bb66848947e37a999502b813c77269 (patch)
tree612c010fc8317e1cdf11471a18aad0270819d33e /server/src/commands/util/Help.ts
parentfix: if clear amount equal or over 100, round down to 99 (diff)
downloaddep-core-bb511abc03bb66848947e37a999502b813c77269.tar.xz
dep-core-bb511abc03bb66848947e37a999502b813c77269.zip
goodbye old uwufier :cry:
Diffstat (limited to 'server/src/commands/util/Help.ts')
-rw-r--r--server/src/commands/util/Help.ts100
1 files changed, 100 insertions, 0 deletions
diff --git a/server/src/commands/util/Help.ts b/server/src/commands/util/Help.ts
new file mode 100644
index 0000000..76d2bf6
--- /dev/null
+++ b/server/src/commands/util/Help.ts
@@ -0,0 +1,100 @@
+import { Command } from 'discord-akairo';
+import { Message } from 'discord.js';
+import { colour } from '../../Config';
+
+export default class HelpUtil extends Command {
+ public constructor() {
+ super('help', {
+ aliases: ['help'],
+ category: 'utility',
+ description: {
+ content: 'List help features or get information on a specified command.',
+ usage: '[command]',
+ examples: [
+ '',
+ '8ball'
+ ]
+ },
+ ratelimit: 3,
+ clientPermissions: ['EMBED_LINKS'],
+ args: [
+ {
+ id: 'command',
+ type: 'commandAlias',
+ prompt: {
+ start: 'Which command do you need help with?',
+ retry: 'Please provide a valid command.',
+ optional: true
+ },
+ match: 'rest'
+ }
+ ]
+ });
+ }
+
+ public exec(msg: Message, { command }): Promise<void | Message> {
+ if (!command) {
+ const embed = this.client.util.embed()
+ .setColor(colour)
+ .addFields([
+ {
+ name: 'Online Command List',
+ value: '*Coming soon!*'
+ },
+ {
+ name: 'Specific Command Help',
+ value: `${this.handler.prefix}help <command>`
+ },
+ {
+ name: 'List of all public categories',
+ value: `${this.handler.prefix}categories`
+ }
+ ]);
+ return msg.channel.send({ embed });
+ }
+
+ const description = Object.assign({
+ content: 'No description available.',
+ usage: '',
+ examples: [],
+ fields: []
+ }, command.description);
+
+ const embed = this.client.util.embed()
+ .setColor(colour)
+ .setTitle(`\`${this.client.commandHandler.prefix}${command.aliases[0]} ${description.usage}\``)
+ .addField('Description', description.content);
+
+ for (const field of description.fields) embed.addField(field.name, field.value);
+
+ if (command.aliases.length > 1) {
+ embed.addField('Aliases', `\`${command.aliases.join('`, `')}\``, true);
+ }
+
+ if (command.description.examples.length >= 1) {
+ embed.addField('Examples', `\`${this.client.commandHandler.prefix}${command.aliases[0]} ${command.description.examples.join(`, ${this.client.commandHandler.prefix}${command.aliases[0]} `)}\``, true);
+ }
+
+ if (command.userPermissions) {
+ embed.addField('User permission', `\`${command.userPermissions.join('` `')}\``, true);
+ }
+
+ if (command.clientPermissions) {
+ embed.addField('Bot permission', `\`${command.clientPermissions.join('` `')}\``, true);
+ }
+
+ if (command.contentParser.flagWords.length) {
+ embed.addField('Command flags', `\`${command.contentParser.flagWords.join('` `')}\``, true);
+ }
+
+ if (command.contentParser.optionFlagWords.length) {
+ embed.addField('Command options flags', `\`${command.contentParser.optionFlagWords.join('` `')}\``, true);
+ }
+
+ if (msg.channel.type === 'dm') return msg.author.send({ embed });
+ return msg.reply('sending you a DM with information...').then(async m => {
+ await msg.author.send({ embed });
+ m.edit('I\'ve send you a DM with information!');
+ });
+ }
+} \ No newline at end of file