aboutsummaryrefslogtreecommitdiff
path: root/commands/help.js
blob: 6e97fcd04655c526bd0097b86f4111230c759c9a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
exports.run = (bot, msg) => {
  const { RichEmbed } = require('discord.js');
  const embed = new RichEmbed();
  embed
    .setColor (0x00ae86)
    .setDescription('Notice: When using a command do not include "<" and ">".\n(Example: p:suggest Test)')
    .setFooter('PokeBot Beta');

  const categories = [];
  const commands = Array.from(bot.commands.keys());

  commands.forEach(function(x) {
    if (!categories.includes(bot.commands.get(x).help.category)) {
      categories.push(bot.commands.get(x).help.category);
    }
  });

  categories.forEach(function(x) {
    let cat = '';
    commands.forEach(function(command) {
      if (bot.commands.get(command).help.category == x) {
        const usage = bot.commands.get(command).help.usage ? `*${bot.commands.get(command).help.usage}* ` : '';
        cat += `**p:${command}** ${usage}| ${bot.commands.get(command).help.description} \n`;
      }
    });
    embed.addField(`${x} |`, cat);
  });
  msg.channel.send({ embed });
};

exports.conf = {
  aliases: [],
  guildOnly: true,
};

exports.help = {
  name: 'help',
  description: 'Displays this help message.',
  category: 'Getting Started',
};