This repository has been archived on 2025-08-25. You can view files and clone it, but cannot push or open issues or pull requests.
Files
shiro-calculator/commands/help.js
koneko 45d2b2c352
All checks were successful
Deploy bot / build-and-deploy (push) Successful in 14s
xD
2025-08-08 00:29:15 +02:00

44 lines
1.4 KiB
JavaScript

const { EmbedBuilder } = require("discord.js");
exports.name = "help";
exports.description =
":scroll: Shows this message and provides insight into other commands.";
exports.usage = "<<help [optional other command]";
exports.example = "<<help res";
exports.hidden = false;
exports.run = (client, message, args) => {
let embed = new EmbedBuilder();
embed.setTitle("Commands Helper");
if (args[0]) {
const cmd = client.commands.get(args[0]);
if (!cmd)
return message.channel.send(
"Command not found, try `<<help` first."
);
if (cmd.hidden && message.author.id != client.ownerID) return;
embed.setTitle(`Help for \`${cmd.name}\` command`);
embed.setDescription(cmd.description);
embed.addFields(
{
name: "Usage",
value: cmd.usage,
},
{
name: "Example",
value: cmd.example,
}
);
} else {
[...client.commands.values()]
.sort((a, b) => (a.name > b.name ? 1 : -1))
.forEach((cmd) => {
if (cmd.hidden && message.author.id != client.ownerID) return;
embed.addFields({
name: cmd.name,
value: cmd.description,
});
});
}
embed.setColor(0x00ff00);
message.channel.send({ embeds: [embed] });
};