Reformatted source files (print width: 180)

This commit is contained in:
mmacierzanka committed 2021-08-20 21:31:15 +02:00
1 parent 54c4c38d62
commit f57c3b3f86
8 files changed
+98 -407

No files matched your search

+9 -42
View File
@@ -4,11 +4,7 @@ import { CommandManager } from "./CommandManager.js";
import { HelpMessageParams } from "./types.js";
export class HelpMessage extends Command {
constructor(
cmdManager: CommandManager,
params: HelpMessageParams,
botName?: string
) {
constructor(cmdManager: CommandManager, params: HelpMessageParams, botName?: string) {
super({
name: "help",
usage: params.usage,
@@ -17,8 +13,7 @@ export class HelpMessage extends Command {
parameters: [
{
name: "command_name",
description:
"Name of the command that you want to get details about",
description: "Name of the command that you want to get details about",
optional: true,
type: "string",
},
@@ -30,35 +25,17 @@ export class HelpMessage extends Command {
helpMsg.setFooter(botName || "");
if (helpMsg != null) {
if (param("command_name")) {
const cmd: Command | null = cmdManager.get(
param("command_name")?.toString() || ""
);
const cmd: Command | null = cmdManager.get(param("command_name")?.toString() || "");
if (cmd) {
helpMsg.setTitle(
`${cmd.name} ${cmd.visible ? "" : "[HIDDEN]"}`
);
helpMsg.setTitle(`${cmd.name} ${cmd.visible ? "" : "[HIDDEN]"}`);
helpMsg.setDescription(cmd.description);
if (cmd.usage)
helpMsg.addField(
"Usage:",
`${cmdManager.prefix || "/"}${cmd.name} ${
cmd.usage
}`,
false
);
if (
cmd.permissions &&
cmd.permissions.toArray(false).length > 0
) {
if (cmd.usage) helpMsg.addField("Usage:", `${cmdManager.prefix || "/"}${cmd.name} ${cmd.usage}`, false);
if (cmd.permissions && cmd.permissions.toArray(false).length > 0) {
let permList: string = "";
cmd.permissions.toArray(false).map((p) => {
permList += p + "\n";
});
helpMsg.addField(
"Permissions:",
permList,
false
);
helpMsg.addField("Permissions:", permList, false);
}
if (cmd.aliases && cmd.aliases.length > 0) {
let aList: string = "";
@@ -68,11 +45,7 @@ export class HelpMessage extends Command {
helpMsg.addField("Aliases:", aList, false);
}
} else {
throw new ReferenceError(
`Command "${param(
"command_name"
)}" does not exist`
);
throw new ReferenceError(`Command "${param("command_name")}" does not exist`);
}
} else {
helpMsg.setTitle(params.title);
@@ -80,13 +53,7 @@ export class HelpMessage extends Command {
cmdManager.list.map((c) => {
if (c.visible) {
helpMsg.addField(
`${cmdManager.prefix || "/"}${c.name} ${
c.usage
}`,
c.description,
false
);
helpMsg.addField(`${cmdManager.prefix || "/"}${c.name} ${c.usage}`, c.description, false);
}
});
}