Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var bot = require('../../commandclient.js')
  2.  
  3. module.exports = {
  4.   label: 'help',
  5.   dm: false,
  6.   enabled: true,
  7.   generator: (msg, args) => {
  8.       var result = "";
  9.       if(args.length > 0) {
  10.           var cur = bot.commands[bot.commandAliases[args[0]] || args[0]];
  11.           if(!cur) {
  12.               return "<:notdone:334852376034803714> Command not found";
  13.           }
  14.           var label = cur.label;
  15.           for(var i = 1; i < args.length; ++i) {
  16.               cur = cur.subcommands[cur.subcommandAliases[args[i]] || args[i]];
  17.               if(!cur) {
  18.                   return "<:notdone:334852376034803714> Command not found";
  19.               }
  20.               label += " " + cur.label;
  21.           }
  22.           result += `**Command:** [>${label}]() \n**Usage:** ${cur.usage}\n**Description:** ${cur.fullDescription}`;
  23.           if(Object.keys(cur.aliases).length > 0) {
  24.               result += `\n\n**Aliases:** ${cur.aliases.join(", ")}`;
  25.           }
  26.           if(Object.keys(cur.subcommands).length > 0) {
  27.               result += "\n\n**Subcommands:**";
  28.               for(var subLabel in cur.subcommands) {
  29.                   if(cur.subcommands[subLabel].permissionCheck(msg)) {
  30.                       result += `\n  **${subLabel}** - ${cur.subcommands[subLabel].description}`;
  31.                   }
  32.               }
  33.           }
  34.       } else {
  35.           result += `${bot.commandOptions.name} - ${bot.commandOptions.description}\n`;
  36.           if(bot.commandOptions.owner) {
  37.               result += `by ${bot.commandOptions.owner}\n`;
  38.           }
  39.           result += "\n";
  40.           result += "**Commands:**\n";
  41.           for(label in bot.commands) {
  42.               if(bot.commands[label] && bot.commands[label].permissionCheck(msg)) {
  43.                   result += `  [>${label}]() - ${bot.commands[label].description}\n`;
  44.               }
  45.           }
  46.           var footer = `\nType >help <command> for more info on a command.`;
  47.       }
  48.       var rando = (function co(lor){   return (lor +=
  49.       [0,1,2,3,4,5,6,7,8,9][Math.floor(Math.random()*10)])
  50.       && (lor.length == 7) ?  lor : co(lor); })('');
  51.  
  52.       if(args.length > 0) {
  53.       bot.createMessage(msg.channel.id, {
  54.               "embed": {
  55.                   "color": 3447003,
  56.                   "description": result,
  57.                   "author": {
  58.                       "name": "Commands",
  59.                       "icon_url": bot.user.dynamicAvatarURL("png")
  60.                   },
  61.                   "footer": {
  62.                       "text": footer,
  63.                     }
  64.                   }
  65.                 }).catch((err) => {
  66.                   console.log(err);
  67.                 });
  68.               } else {
  69.                 bot.createMessage(msg.channel.id, `:mailbox_with_mail: **${msg.author.username}**, Help Sent!`)
  70.                 bot.getDMChannel(msg.author.id).then(dm =>
  71.                 bot.createMessage(dm.id, {
  72.                   "embed": {
  73.                       "color": 3447003,
  74.                       "description": result,
  75.                       "author": {
  76.                           "name": "Commands",
  77.                           "icon_url": bot.user.dynamicAvatarURL("png")
  78.                       },
  79.                       "footer": {
  80.                           "text": footer,
  81.                         },
  82.                         "fields": [
  83.                           {
  84.                             "name": "Invite Link",
  85.                             "value": `Cannot invite me, sorry!`,
  86.                             "inline": true,
  87.                           },{
  88.                             "name": "Support Server",
  89.                             "value": `[Join my server by clicking here](https://discord.gg/MqQsmF7)`,
  90.                             "inline": true,
  91.                           }
  92.                         ]
  93.                       }
  94.                     })).catch((err) => {
  95.                       console.log(err);
  96.                     });
  97.           }
  98.     },
  99.     options: {
  100.       description: "Shows this text.",
  101.       fullDescription: "Sends you Trinity's commands."
  102.     }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement