Archived
added server-specific help messages
This commit is contained in:
1 parent
5af76c04ae
commit
f71ea8cfa4
1 file changed
+13
-5
+13
-5
@@ -19,15 +19,18 @@ export class HelpMessage extends Command {
|
|||||||
type: "string",
|
type: "string",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
function: (param, _) => {
|
function: (p, i) => {
|
||||||
const helpMsg = new MessageEmbed();
|
const helpMsg = new MessageEmbed();
|
||||||
helpMsg.setColor(params.color);
|
helpMsg.setColor(params.color);
|
||||||
helpMsg.setTimestamp();
|
helpMsg.setTimestamp();
|
||||||
helpMsg.setFooter(botName || "");
|
helpMsg.setFooter(botName || "");
|
||||||
if (helpMsg != null) {
|
if (helpMsg != null) {
|
||||||
if (param("command_name")) {
|
if (p("command_name")) {
|
||||||
const cmd: Command | null = cmdManager.get(param("command_name")?.toString() || "");
|
const cmd: Command | null = cmdManager.get(p("command_name")?.toString() || "");
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
|
if (Array.isArray(cmd.guilds) && cmd.guilds.length > 0 && !cmd.guilds.find((g) => i?.guild?.id === g)) {
|
||||||
|
throw new ReferenceError(`Command "${cmd.name}" is not available`);
|
||||||
|
}
|
||||||
helpMsg.setTitle(`${cmd.name} ${cmd.visible ? "" : "[HIDDEN]"}`);
|
helpMsg.setTitle(`${cmd.name} ${cmd.visible ? "" : "[HIDDEN]"}`);
|
||||||
helpMsg.setDescription(cmd.description);
|
helpMsg.setDescription(cmd.description);
|
||||||
if (cmd.usage) helpMsg.addField("Usage:", `${cmdManager.prefix || "/"}${cmd.name} ${cmd.usage}`, false);
|
if (cmd.usage) helpMsg.addField("Usage:", `${cmdManager.prefix || "/"}${cmd.name} ${cmd.usage}`, false);
|
||||||
@@ -49,15 +52,20 @@ export class HelpMessage extends Command {
|
|||||||
});
|
});
|
||||||
helpMsg.addField("Aliases:", aList, false);
|
helpMsg.addField("Aliases:", aList, false);
|
||||||
}
|
}
|
||||||
|
helpMsg.addField("Slash command:", cmd.slash ? "ENABLED" : "DISABLED", false);
|
||||||
|
helpMsg.addField("Command scope:", Array.isArray(cmd.guilds) && cmd.guilds.length > 0 ? "CUSTOM" : "GLOBAL", false);
|
||||||
} else {
|
} else {
|
||||||
throw new ReferenceError(`Command "${param("command_name")}" does not exist`);
|
throw new ReferenceError(`Command "${p("command_name")}" does not exist`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
helpMsg.setTitle(params.title);
|
helpMsg.setTitle(params.title);
|
||||||
helpMsg.setDescription(params.bottomText);
|
helpMsg.setDescription(params.bottomText);
|
||||||
|
|
||||||
cmdManager.list.map((c) => {
|
cmdManager.list.map((c) => {
|
||||||
if (c.visible) {
|
if (
|
||||||
|
c.visible &&
|
||||||
|
((Array.isArray(c.guilds) && c.guilds.length > 0 && c.guilds.find((g) => i?.guild?.id === g)) || !Array.isArray(c.guilds) || c.guilds.length === 0)
|
||||||
|
) {
|
||||||
helpMsg.addField(`${cmdManager.prefix || "/"}${c.name} ${c.usage}`, c.description, false);
|
helpMsg.addField(`${cmdManager.prefix || "/"}${c.name} ${c.usage}`, c.description, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user