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