Files
quarksBot/commands/help.js
T
2022-08-08 07:09:42 -07:00

200 lines
7.5 KiB
JavaScript

const { MessageEmbed } = require("discord.js");
module.exports = {
name: "help",
debug: false,
description: "Get information on a specific command",
usage: "[option]",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
SlashCommand: {
options: [
{
name: "commands",
description: "List all commands",
value: "commands",
type: 1,
options: [{
name: "command",
description: "Get information on a specific command",
value: "command",
type: 3,
required: false,
}]
},
{
name: "settings",
description: "How to configure the settings",
value: "settings",
type: 1,
},
{
name: "support",
description: "Get support for QuarksBot",
value: "support",
type: 1,
},
{
name: "credits",
description: "QuarksBot Credits",
value: "credits",
type: 1,
}
],
/**
*
* @param {require("../structures/QuarksBot")} 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.`);
}
if (args[0].name == 'commands') {
let Commands = client.commands.filter((cmd) => {
return !cmd.debug
}).map((cmd) =>
`\`/${cmd.name}${cmd.usage ? " " + cmd.usage : ""}\` - ${cmd.description}`
);
let Embed = new MessageEmbed()
.setColor(client.config.EmbedColor)
.setDescription(`${Commands.join("\n")}
QuarksBot Version: v${client.config.Version}`);
if (!args[0].options[0]) return interaction.send(Embed);
else {
let cmd =
client.commands.get(args[0].options[0].value) ||
client.commands.find(
(x) => x.aliases && x.aliases.includes(args[0].options[0].value)
);
if (!cmd)
return client.sendTime(
interaction,
`❌ | Unable to find that command.`
);
let embed = new MessageEmbed()
.setDescription(cmd.description)
.setColor("GREEN")
.setTitle(`How to use /${cmd.name} command`)
if (cmd.SlashCommand.options && cmd.SlashCommand.options[0].type == 1) {
let description = `${cmd.description}\n\n**Usage**\n`;
for (let i = 0; i < cmd.SlashCommand.options.length; i++) {
if (cmd.SlashCommand.options[i].type == 1) {
let param = '';
if (cmd.SlashCommand.options[i].options) {
param = cmd.SlashCommand.options[i].options.length > 0 ? ' ' : '';
for (let j = 0; j < cmd.SlashCommand.options[i].options.length; j++) {
if (cmd.SlashCommand.options[i].options[j].required) param += `[${cmd.SlashCommand.options[i].options[j].name}] `
}
}
description += `\`/${cmd.name} ${cmd.SlashCommand.options[i].name}${param}\`\n${cmd.SlashCommand.options[i].description}\n\n`
}
}
embed.setDescription(description);
} else {
embed.addField(
"Usage",
`\`/${cmd.name}\`${cmd.usage ? " " + cmd.usage : ""}`,
true
)
}
return interaction.send(embed);
}
} else if (args[0].name == 'settings') {
const settingsHelp = new MessageEmbed()
.setColor(client.config.EmbedColor)
.setTitle('Using settings command to configure your guild')
.setDescription(`Some features of QuarksBot require, or recommend settings.
**__1. Action Channel:__**
Optionally you can have a dedicated channel for the \`/me\` command, keeping your channels clean.
Use \`/settings action_channel set [channel]\` to configure this setting.
or...
use \`/settings action_channel remove [channel]\` to remove your dedicated action channel.
**__2. Tweet Channel:__**
Optionally you can have a dedicated channel for the \`/tweet\` command, keeping your channels clean.
Use \`/settings tweet_channel set [channel]\` to configure this setting.
or ...
use \`/settings tweet_channel remove [channel]\` to remove your dedicated tweet channel.
**__3. Allowed Channels:__**
If you want to limit what channels people can use QuarksBot,
use \`/settings allowed_channels add [channel]\` to add a channel to a list of allowed channels.
or...
use \`/settings allowed_channels remove [channel]\` to remove a channel from the list of allowed channels.
**__4. Starting Balance:__**
When a user joins your server, they get a starting balance. This can be configured,
use \`/settings starting_balance [amount]\` to set the starting balance.
**__5. Income Roles:__**
The \`/work\` command required a user to have a role that has a defined income.
Use \`/settings set_income_role [role] [amount]\` to add a role to the list of roles to earn income.
or...
use \`/settings remove_income_role [role]\` to remove a role from the list of roles to earn income.
**Note:**
- Users may only use \`/work\` command once every 24 hours.
- If a user has more than one role that can earn income, the bot will pay them for the role with the highest income.
- The amount you enter for a role to earn is the amount they will be paid when using the \`/work\` command. Be sure that the amount you choose is a daily income, not hourly, etc.
**__6. Viewing Settings:__**
If you are unsure of your current configured settings, use \`/settings view\` to get a detailed view of your configurations.`);
return interaction.send({ embeds: [settingsHelp] });
} else if (args[0].name == 'support') {
const supportEmbed = new MessageEmbed()
.setColor(client.config.EmbedColor)
.setDescription(`**__QuarksBot Support__**
Are you experiencing troubles with QuarksBot?
Do you have questions or concerns?
Do you require help to use the bot?
Do you have a feature you'd like to see?
Join the support server to have all your needs fulfilled.
╚➤ ${client.config.SupportServer}
`)
return interaction.send({ embeds: [supportEmbed] });
} else if (args[0].name == 'credits') {
const creditsEmbed = new MessageEmbed()
.setColor(client.config.EmbedColor)
.setTitle('QuarksBot Credits')
.setDescription(`
**Bot Author:** McDazzzled#5307
Special thanks to Mav#1518 for the introduction to the project idea,
as well as providing feedback on features and providing feature ideas.
${client.config.SupportServer}
`);
return interaction.send({ embeds: [creditsEmbed] })
}
},
},
};