|
1 | | -const {readdirSync} = require("fs"); |
| 1 | +const { readdirSync } = require("fs"); |
2 | 2 |
|
3 | 3 | // Example of how to make a Help Command |
4 | 4 |
|
5 | 5 | module.exports = { |
6 | | - name: "help", |
7 | | - aliases: ["h", "commands"], |
8 | | - usage: '!help <command>', |
9 | | - category: "Bot", |
10 | | - description: "Return all commands, or one specific command!", |
11 | | - run: async (client, message, args) => { |
| 6 | + name: "help", |
| 7 | + aliases: ["h", "commands"], |
| 8 | + usage: '!help <command>', |
| 9 | + category: "Bot", |
| 10 | + description: "Return all commands, or one specific command!", |
| 11 | + ownerOnly: false, |
| 12 | + run: async (client, message, args) => { |
12 | 13 |
|
13 | | - // Buttons that take you to a link |
14 | | - // If you want to delete them, remove this part of |
15 | | - // the code and in line: 55 delete ", components: [row]" |
16 | | - const row = new client.discord.MessageActionRow() |
17 | | - .addComponents( |
18 | | - new client.discord.MessageButton() |
19 | | - .setLabel("GitHub") |
20 | | - .setStyle("LINK") |
21 | | - .setURL("https://github.com/Expectatives/Discord.js-v13-Example"), |
22 | | - new client.discord.MessageButton() |
23 | | - .setLabel("Support") |
24 | | - .setStyle("LINK") |
25 | | - .setURL("https://dsc.gg/faithcommunity") |
26 | | - ); |
27 | | - |
28 | | - if (!args[0]) { |
| 14 | + // Buttons that take you to a link |
| 15 | + // If you want to delete them, remove this part of |
| 16 | + // the code and in line: 55 delete ", components: [row]" |
| 17 | + const row = new client.discord.MessageActionRow() |
| 18 | + .addComponents( |
| 19 | + new client.discord.MessageButton() |
| 20 | + .setLabel("GitHub") |
| 21 | + .setStyle("LINK") |
| 22 | + .setURL("https://github.com/Expectatives/Discord.js-v13-Example"), |
| 23 | + new client.discord.MessageButton() |
| 24 | + .setLabel("Support") |
| 25 | + .setStyle("LINK") |
| 26 | + .setURL("https://dsc.gg/faithcommunity") |
| 27 | + ); |
29 | 28 |
|
30 | | - // Get the commands of a Bot category |
31 | | - const botCommandsList = []; |
32 | | - readdirSync(`./commands/Bot`).forEach((file) => { |
33 | | - const filen = require(`../../commands/Bot/${file}`); |
34 | | - const name = `\`${filen.name}\`` |
35 | | - botCommandsList.push(name); |
36 | | - }); |
| 29 | + if (!args[0]) { |
37 | 30 |
|
38 | | - // Get the commands of a Utility category |
39 | | - const utilityCommandsList = []; |
40 | | - readdirSync(`./commands/Utility`).forEach((file) => { |
41 | | - const filen = require(`../../commands/Utility/${file}`); |
42 | | - const name = `\`${filen.name}\`` |
43 | | - utilityCommandsList.push(name); |
44 | | - }); |
| 31 | + // Get the commands of a Bot category |
| 32 | + const botCommandsList = []; |
| 33 | + readdirSync(`./commands/Bot`).forEach((file) => { |
| 34 | + const filen = require(`../../commands/Bot/${file}`); |
| 35 | + const name = `\`${filen.name}\`` |
| 36 | + botCommandsList.push(name); |
| 37 | + }); |
45 | 38 |
|
46 | | - // This is what it commands when using the command without arguments |
47 | | - const helpEmbed = new client.discord.MessageEmbed() |
48 | | - .setTitle(`${client.user.username} Help`) |
49 | | - .setDescription(` Hello **<@${message.author.id}>**, I am <@${client.user.id}>. \nYou can use \`!help <command>\` to see more info about the commands!\n**Total Commands:** ${client.commands.size}\n**Total SlashCommands:** ${client.slashCommands.size}`) |
50 | | - .addField("🤖 - Bot Commands", botCommandsList.map((data) => `${data}`).join(", "), true) |
51 | | - .addField("🛠 - Utility Commands", utilityCommandsList.map((data) => `${data}`).join(", "), true) |
52 | | - .setColor(client.config.embedColor) |
53 | | - .setFooter(client.config.embedfooterText, client.user.avatarURL()); |
54 | | - |
55 | | - message.reply({embeds: [helpEmbed], allowedMentions: {repliedUser: false}, components: [row]}); |
56 | | - } else { |
57 | | - const command = client.commands.get(args[0].toLowerCase()) || client.commands.find((c) => c.aliases && c.aliases.includes(args[0].toLowerCase())); |
| 39 | + // Get the commands of a Utility category |
| 40 | + const utilityCommandsList = []; |
| 41 | + readdirSync(`./commands/Utility`).forEach((file) => { |
| 42 | + const filen = require(`../../commands/Utility/${file}`); |
| 43 | + const name = `\`${filen.name}\`` |
| 44 | + utilityCommandsList.push(name); |
| 45 | + }); |
58 | 46 |
|
59 | | - // This is what it sends when using the command with argument and it does not find the command |
60 | | - if (!command) { |
61 | | - message.reply({content: `There isn't any command named "${args[0]}"`, allowedMentions: {repliedUser: false}}); |
62 | | - } else { |
| 47 | + // This is what it commands when using the command without arguments |
| 48 | + const helpEmbed = new client.discord.MessageEmbed() |
| 49 | + .setTitle(`${client.user.username} Help`) |
| 50 | + .setDescription(` Hello **<@${message.author.id}>**, I am <@${client.user.id}>. \nYou can use \`!help <command>\` to see more info about the commands!\n**Total Commands:** ${client.commands.size}\n**Total SlashCommands:** ${client.slash.size}`) |
| 51 | + .addField("🤖 - Bot Commands", botCommandsList.map((data) => `${data}`).join(", "), true) |
| 52 | + .addField("🛠 - Utility Commands", utilityCommandsList.map((data) => `${data}`).join(", "), true) |
| 53 | + .setColor(client.config.embedColor) |
| 54 | + .setFooter({ text: `${client.config.embedfooterText}`, iconURL: `${client.user.displayAvatarURL()}` }); |
63 | 55 |
|
64 | | - // This is what it sends when using the command with argument and if it finds the command |
65 | | - let command = client.commands.get(args[0].toLowerCase()) || client.commands.find((c) => c.aliases && c.aliases.includes(args[0].toLowerCase())); |
66 | | - let name = command.name; |
67 | | - let description = command.description || "No descrpition provided" |
68 | | - let usage = command.usage || "No usage provided" |
69 | | - let aliases = command.aliases || "No aliases provided" |
70 | | - let category = command.category || "No category provided!" |
| 56 | + message.reply({ embeds: [helpEmbed], allowedMentions: { repliedUser: false }, components: [row] }); |
| 57 | + } else { |
| 58 | + const command = client.commands.get(args[0].toLowerCase()) || client.commands.find((c) => c.aliases && c.aliases.includes(args[0].toLowerCase())); |
71 | 59 |
|
72 | | - let helpCmdEmbed = new client.discord.MessageEmbed() |
73 | | - .setTitle(`${client.user.username} Help | \`${(name.toLocaleString())}\` Command`) |
74 | | - .addFields( |
75 | | - { name: "Description", value: `${description}` }, |
76 | | - { name: "Usage", value: `${usage}` }, |
77 | | - { name: "Aliases", value: `${aliases}` }, |
78 | | - { name: 'Category', value: `${category}` }) |
79 | | - .setColor(client.config.embedColor) |
80 | | - .setFooter(client.config.embedfooterText, client.user.avatarURL()); |
81 | | - |
82 | | - message.reply({embeds: [helpCmdEmbed], allowedMentions: {repliedUser: false}}); |
83 | | - } |
84 | | - } |
85 | | - }, |
| 60 | + // This is what it sends when using the command with argument and it does not find the command |
| 61 | + if (!command) { |
| 62 | + message.reply({ content: `There isn't any command named "${args[0]}"`, allowedMentions: { repliedUser: false } }); |
| 63 | + } else { |
| 64 | + |
| 65 | + // This is what it sends when using the command with argument and if it finds the command |
| 66 | + let command = client.commands.get(args[0].toLowerCase()) || client.commands.find((c) => c.aliases && c.aliases.includes(args[0].toLowerCase())); |
| 67 | + let name = command.name; |
| 68 | + let description = command.description || "No descrpition provided" |
| 69 | + let usage = command.usage || "No usage provided" |
| 70 | + let aliases = command.aliases || "No aliases provided" |
| 71 | + let category = command.category || "No category provided!" |
| 72 | + |
| 73 | + let helpCmdEmbed = new client.discord.MessageEmbed() |
| 74 | + .setTitle(`${client.user.username} Help | \`${(name.toLocaleString())}\` Command`) |
| 75 | + .addFields( |
| 76 | + { name: "Description", value: `${description}` }, |
| 77 | + { name: "Usage", value: `${usage}` }, |
| 78 | + { name: "Aliases", value: `${aliases}` }, |
| 79 | + { name: 'Category', value: `${category}` }) |
| 80 | + .setColor(client.config.embedColor) |
| 81 | + .setFooter({ text: `${client.config.embedfooterText}`, iconURL: `${client.user.displayAvatarURL()}` }); |
| 82 | + |
| 83 | + message.reply({ embeds: [helpCmdEmbed], allowedMentions: { repliedUser: false } }); |
| 84 | + } |
| 85 | + } |
| 86 | + }, |
86 | 87 | }; |
0 commit comments