easy-discord-logs
Version:
Advanced discord logs system and easy usage!
68 lines (67 loc) • 3.74 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const discord_js_1 = require("discord.js");
const BaseCommand_1 = __importDefault(require("../../utils/structures/BaseCommand"));
class HelpCommand extends BaseCommand_1.default {
constructor() {
super("help", "Utility", []);
}
run(client, message, args) {
return __awaiter(this, void 0, void 0, function* () {
const Developer = yield client.users.fetch("799364333678886962");
let commandsObj = {};
let prefix = client.prefix;
client.logsCommands.map((command) => {
!commandsObj[command.getCategory().toLowerCase()] &&
(commandsObj[command.getCategory().toLowerCase()] = []);
command.getCategory().toLocaleLowerCase() === "logs" &&
commandsObj[command.getCategory().toLowerCase()].push({
command: command.getName(),
aliases: command.getAliases(),
});
});
if (args[0]) {
if (args[0].toLowerCase() === "command") {
if (!args[1])
return message.channel.send("Enter the command name!");
const command = client.logsCommands.get(args[1]) || client.logsAliases.get(args[1]);
if (!command)
return message.channel.send("Can't find that command!");
const embed = new discord_js_1.MessageEmbed()
.setTitle("Help Command")
.setDescription(`\`\`\`${command.getName().replace("-", " ")} Command!\`\`\``)
.addField("Category", command.getCategory())
.addField("Aliases", command.getAliases()[0] ? command.getAliases()[0] : "No Aliases")
.setColor("#add8e6");
return message.channel.send(embed);
}
const embed = new discord_js_1.MessageEmbed()
.setTitle("Help Command")
.setDescription(`Bot Help Commands!\nType\n\`\`\`For more help\n${prefix}help command <Command Name>\`\`\``)
.setColor("#add8e6")
.setFooter(`Developer: ${Developer.tag}`, Developer.displayAvatarURL({ dynamic: true, size: 4096 }));
if (!commandsObj[args[0].toLowerCase()])
return;
commandsObj[args[0].toLowerCase()].forEach((cmd) => {
embed.addField(`> ${cmd.command}`, `**Aliases:**\n${cmd.aliases[0] ? cmd.aliases : "No Aliases"}`, true);
});
message.channel.send(embed);
}
else
return;
});
}
}
exports.default = HelpCommand;