Files
police-cad-bot/commands/help.js
T
2022-03-16 17:58:54 -07:00

167 lines
5.1 KiB
JavaScript

const { MessageEmbed } = require("discord.js");
module.exports = {
name: "help",
description: "Get information on a specific command",
usage: "[command]",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
aliases: ["command", "commands", "cmd"],
/**
*
* @param {require("../structures/LinesPoliceCadBot")} client
* @param {import("discord.js").Message} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, message, args, { GuildDB }) => {
let Commands = client.commands.map((cmd) =>
cmd.name != 'debug' ? `\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
cmd.name
}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}` : null
);
let Embed = new MessageEmbed()
.setAuthor(
`Commands of ${client.user.username}`,
client.config.IconURL
)
.setColor(client.config.EmbedColor)
.setFooter(
`To get info of each command type ${
GuildDB ? GuildDB.prefix : client.config.DefaultPrefix
}help [Command] | Have a nice day!`
).setDescription(`${Commands.join("\n")}
Lines Police CAD Bot Version: v${client.config.Version}`);
if (!args[0]) {
message.channel.send({ embeds: [Embed] });
}
else {
let cmd =
client.commands.get(args[0]) ||
client.commands.find((x) => x.aliases && x.aliases.includes(args[0]));
if (!cmd)
return client.sendTime(
message.channel,
`❌ | Unable to find that command.`
);
let embed = new MessageEmbed()
.setAuthor(`Command: ${cmd.name}`, client.config.IconURL)
.setDescription(cmd.description)
.setColor("GREEN")
//.addField("Name", cmd.name, true)
.addField("Aliases", `\`${cmd.aliases.join(", ")}\``, true)
.addField(
"Usage",
`\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
cmd.name
}${cmd.usage ? " " + cmd.usage : ""}\``,
true
)
.addField(
"Permissions",
"Member: " +
cmd.permissions.member.join(", ") +
"\nBot: " +
cmd.permissions.channel.join(", "),
true
)
.setFooter(
`Prefix - ${
GuildDB ? GuildDB.prefix : client.config.DefaultPrefix
}`
);
message.channel.send({ embeds: [embed] });
}
},
SlashCommand: {
options: [
{
name: "command",
description: "Get information on a specific command",
value: "command",
type: 3,
required: false,
},
],
/**
*
* @param {require("../structures/LinesPoliceCadBot")} client
* @param {import("discord.js").Message} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
}
let Commands = client.commands.map((cmd) =>
cmd.name != 'debug' ? `\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
cmd.name
}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}` : null
);
let Embed = new MessageEmbed()
.setAuthor(
`Commands of ${client.user.username}`,
client.config.IconURL
)
.setColor(client.config.EmbedColor)
.setFooter(
`To get info of each command type ${
GuildDB ? GuildDB.prefix : client.config.DefaultPrefix
}help [Command] | Have a nice day!`
).setDescription(`${Commands.join("\n")}
Lines Police CAD Bot Version: v${client.Version}`);
if (!args) return interaction.send(Embed);
else {
let cmd =
client.commands.get(args[0].value) ||
client.commands.find(
(x) => x.aliases && x.aliases.includes(args[0].value)
);
if (!cmd)
return client.sendTime(
interaction,
`❌ | Unable to find that command.`
);
let embed = new MessageEmbed()
.setAuthor(`Command: ${cmd.name}`, client.config.IconURL)
.setDescription(cmd.description)
.setColor("GREEN")
//.addField("Name", cmd.name, true)
.addField("Aliases", cmd.aliases.join(", "), true)
.addField(
"Usage",
`\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
cmd.name
}\`${cmd.usage ? " " + cmd.usage : ""}`,
true
)
.addField(
"Permissions",
"Member: " +
cmd.permissions.member.join(", ") +
"\nBot: " +
cmd.permissions.channel.join(", "),
true
)
.setFooter(
`Prefix - ${
GuildDB ? GuildDB.prefix : client.config.DefaultPrefix
}`
);
interaction.send(embed);
}
},
},
};