Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. const { RichEmbed } = require('discord.js');
  2. const { prefix } = require('../../config.json');
  3. const { readdirSync } = require('fs');
  4. const { stripIndents } = require('common-tags');
  5. const { rosa } = require('../../colours.json');
  6.  
  7. module.exports.run = async (client, message, args) => {
  8. const embed = new RichEmbed()
  9. .setColor(rosa)
  10. .setAuthor(`${message.guild.me.displayName} - Help`, message.guild.iconURL)
  11. .setThumbnail(client.user.displayAvatarURL)
  12.  
  13. if (!args[0]) {
  14. const categories = readdirSync('./comandos/');
  15.  
  16. embed.setDescription(`Estes são os comandos disponiveis.\nO prefixo é: \`${prefix}\``);
  17. embed.setFooter(`© ${message.guild.me.displayName} | Comandos Disponiveis: ${client.commands.size}`, client.user.displayAvatarURL);
  18.  
  19. categories.forEach(category => {
  20. const dir = client.commands.filter(c => c.config.category === category);
  21. const capitalize = category.slice(0, 1).toUpperCase() + category.slice(1);
  22. try {
  23. embed.addField(`❯ ${capitalize} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(' '));
  24. } catch (e) {
  25. console.log(e);
  26. }
  27. });
  28.  
  29. return message.channel.send(embed);
  30. } else {
  31. let cmd = client.commands.get(client.aliases.get(args[0].toLowerCase()) || args[0].toLowerCase());
  32. if (!cmd) return message.channel.send(embed.setTitle('Comando Inválido.').setDescription(`Usa \`${prefix}ajuda\` para a lista de comandos.`));
  33. cmd = cmd.config;
  34.  
  35. embed.setDescription(stripIndents`O prefixo é: \`${prefix}\`\n
  36. **Comando:** ${cmd.name.slice(0, 1).toUpperCase() + cmd.name.slice(1)}
  37. **Descrição:** ${cmd.description || 'Sem descrição.'}
  38. **Uso:** ${cmd.usage ? `\`${cmd.usage}\`` : 'Sem Uso.'}
  39. **Acessivel Por:** ${cmd.accessibleBy || 'Membros'}
  40. **Aliases:** ${cmd.aliases ? cmd.aliases.join(', ') : 'Nenhuma.'}`);
  41.  
  42. return message.channel.send(embed);
  43. }
  44. }
  45.  
  46. module.exports.config = {
  47. name: 'ajuda',
  48. description: 'Mostra a lista de todos os meus comandos',
  49. aliases: ['ajd', 'help', 'commands', 'comandos', 'cmds'],
  50. usage: `${prefix}ajuda`,
  51. category: 'outros',
  52. accessibleBy: 'Membros'
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement