2024-08-21 17:00:40 +02:00
|
|
|
import { encode } from "html-entities";
|
|
|
|
|
|
|
|
function execute(client, event, args) {
|
|
|
|
var name = args.toLowerCase();
|
|
|
|
|
|
|
|
var command = client.commands.filter(c=>(c.name.toLowerCase()==name || c.command.toLowerCase()==name))[0];
|
|
|
|
var module = client.modules.filter(m=>m.name.toLowerCase()==name)[0];
|
|
|
|
var specific = command ?? module ?? false;
|
|
|
|
|
|
|
|
if(args != "") {
|
|
|
|
if(!command && !module) {
|
2024-08-27 21:52:32 +02:00
|
|
|
client.reply(event, `section "${args}" not found.\nrun "${process.env.PREFIX}help" for a list of commands and modules.`);
|
2024-08-21 17:00:40 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(module) {
|
|
|
|
var reply = module.name + "\n";
|
|
|
|
reply += module.desc;
|
|
|
|
|
|
|
|
var replyHTML = `<b>${encode(module.name)}</b><br>` +
|
|
|
|
`<i>${encode(module.desc)}</i>`;
|
|
|
|
|
|
|
|
client.reply(event, reply, replyHTML);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var reply = command.name + "\n" +
|
|
|
|
command.desc + "\n\n" +
|
|
|
|
command.usage;
|
|
|
|
|
|
|
|
var replyHTML = `<b>${encode(command.name)}</b><br>` +
|
|
|
|
`<i>${encode(command.desc)}</i>` +
|
|
|
|
`<br><code>${encode(command.usage)}</code>`;
|
|
|
|
|
|
|
|
client.reply(event, reply, replyHTML);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var reply = `commands: ${client.commands.map(m => m.name).join(", ")}\n` +
|
|
|
|
`modules: ${client.modules.map(m => m.name).join(", ")}\n` +
|
|
|
|
`run ${process.env.PREFIX}help <module/command> for more information.`;
|
|
|
|
|
|
|
|
var replyHTML = `commands: <code>${client.commands.map(m => encode(m.name)).join("</code>, <code>")}</code><br>` +
|
|
|
|
`modules: <code>${client.modules.map(m => encode(m.name)).join("</code>, <code>")}</code><br>` +
|
|
|
|
encode(`run ${process.env.PREFIX}help <module/command> for more information.`);
|
|
|
|
|
|
|
|
client.reply(event, reply, replyHTML);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
command: "help",
|
|
|
|
name: "help",
|
|
|
|
desc: "show list of commands and modules",
|
|
|
|
execute
|
|
|
|
}
|