Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var bot = require('../../commandclient.js')
- module.exports = {
- label: 'help',
- dm: false,
- enabled: true,
- generator: (msg, args) => {
- var result = "";
- if(args.length > 0) {
- var cur = bot.commands[bot.commandAliases[args[0]] || args[0]];
- if(!cur) {
- return "<:notdone:334852376034803714> Command not found";
- }
- var label = cur.label;
- for(var i = 1; i < args.length; ++i) {
- cur = cur.subcommands[cur.subcommandAliases[args[i]] || args[i]];
- if(!cur) {
- return "<:notdone:334852376034803714> Command not found";
- }
- label += " " + cur.label;
- }
- result += `**Command:** [>${label}]() \n**Usage:** ${cur.usage}\n**Description:** ${cur.fullDescription}`;
- if(Object.keys(cur.aliases).length > 0) {
- result += `\n\n**Aliases:** ${cur.aliases.join(", ")}`;
- }
- if(Object.keys(cur.subcommands).length > 0) {
- result += "\n\n**Subcommands:**";
- for(var subLabel in cur.subcommands) {
- if(cur.subcommands[subLabel].permissionCheck(msg)) {
- result += `\n **${subLabel}** - ${cur.subcommands[subLabel].description}`;
- }
- }
- }
- } else {
- result += `${bot.commandOptions.name} - ${bot.commandOptions.description}\n`;
- if(bot.commandOptions.owner) {
- result += `by ${bot.commandOptions.owner}\n`;
- }
- result += "\n";
- result += "**Commands:**\n";
- for(label in bot.commands) {
- if(bot.commands[label] && bot.commands[label].permissionCheck(msg)) {
- result += ` [>${label}]() - ${bot.commands[label].description}\n`;
- }
- }
- var footer = `\nType >help <command> for more info on a command.`;
- }
- var rando = (function co(lor){ return (lor +=
- [0,1,2,3,4,5,6,7,8,9][Math.floor(Math.random()*10)])
- && (lor.length == 7) ? lor : co(lor); })('');
- if(args.length > 0) {
- bot.createMessage(msg.channel.id, {
- "embed": {
- "color": 3447003,
- "description": result,
- "author": {
- "name": "Commands",
- "icon_url": bot.user.dynamicAvatarURL("png")
- },
- "footer": {
- "text": footer,
- }
- }
- }).catch((err) => {
- console.log(err);
- });
- } else {
- bot.createMessage(msg.channel.id, `:mailbox_with_mail: **${msg.author.username}**, Help Sent!`)
- bot.getDMChannel(msg.author.id).then(dm =>
- bot.createMessage(dm.id, {
- "embed": {
- "color": 3447003,
- "description": result,
- "author": {
- "name": "Commands",
- "icon_url": bot.user.dynamicAvatarURL("png")
- },
- "footer": {
- "text": footer,
- },
- "fields": [
- {
- "name": "Invite Link",
- "value": `Cannot invite me, sorry!`,
- "inline": true,
- },{
- "name": "Support Server",
- "value": `[Join my server by clicking here](https://discord.gg/MqQsmF7)`,
- "inline": true,
- }
- ]
- }
- })).catch((err) => {
- console.log(err);
- });
- }
- },
- options: {
- description: "Shows this text.",
- fullDescription: "Sends you Trinity's commands."
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement