Merge branch 'dev' into 'main'
Added staff help command See merge request illegitimate/illegitimate-bot!114
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
|
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js")
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "admin",
|
name: "devel",
|
||||||
description: "Admin command.",
|
description: "Admin command.",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
dev: false,
|
dev: false,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js')
|
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js')
|
||||||
const { color, devMessage } = require("../../config/options.json")
|
const { color, devMessage } = require("../../config/options.json")
|
||||||
const { beast } = require("./staff/beast.js")
|
const { beast } = require("./staff/beast.js")
|
||||||
|
const { help } = require("./staff/help.js")
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "staff",
|
name: "staff",
|
||||||
@@ -12,6 +13,10 @@ module.exports = {
|
|||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("staff")
|
.setName("staff")
|
||||||
.setDescription("Subcommands for staff")
|
.setDescription("Subcommands for staff")
|
||||||
|
.addSubcommand(subcommand =>
|
||||||
|
subcommand
|
||||||
|
.setName("help")
|
||||||
|
.setDescription("Get help with staff commands"))
|
||||||
.addSubcommand(subcommand =>
|
.addSubcommand(subcommand =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("beast")
|
.setName("beast")
|
||||||
@@ -35,6 +40,11 @@ module.exports = {
|
|||||||
const subcommand = interaction.options.getSubcommand()
|
const subcommand = interaction.options.getSubcommand()
|
||||||
const embedColor = Number(color.replace("#", "0x"))
|
const embedColor = Number(color.replace("#", "0x"))
|
||||||
|
|
||||||
|
if (subcommand === "help") {
|
||||||
|
help(interaction)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (subcommand === "beast") {
|
if (subcommand === "beast") {
|
||||||
beast(interaction)
|
beast(interaction)
|
||||||
return
|
return
|
||||||
|
|||||||
46
src/commands/staff/help.js
Normal file
46
src/commands/staff/help.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
const { color, devMessage } = require("../../../config/options.json")
|
||||||
|
const fs = require("fs")
|
||||||
|
const path = require("path")
|
||||||
|
|
||||||
|
/** @param { import("discord.js").ChatInputCommandInteraction } interaction */
|
||||||
|
|
||||||
|
async function help(interaction) {
|
||||||
|
|
||||||
|
const commands = []
|
||||||
|
const commandFiles = fs.readdirSync(path.join(__dirname, "..")).filter(file => file.endsWith(".js"))
|
||||||
|
for (const file of commandFiles) {
|
||||||
|
const command = require(`../../commands/${file}`)
|
||||||
|
if (!command.public) {
|
||||||
|
commands.push(command)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const commandList = commands.map((command) => {
|
||||||
|
return {
|
||||||
|
name: "**/" + command.name + "**",
|
||||||
|
value: "`" + command.description + "`"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const embedColor = Number(color.replace("#", "0x"))
|
||||||
|
const footerText = interaction.guild ? interaction.guild.name : interaction.user.username
|
||||||
|
const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true })
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
title: "Commands",
|
||||||
|
description: "List of commands",
|
||||||
|
fields: commandList,
|
||||||
|
color: embedColor,
|
||||||
|
thumbnail: {
|
||||||
|
url: interaction?.guild?.iconURL({ dynamic: true }) || null
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
icon_url: footerIcon,
|
||||||
|
text: footerText + " | " + devMessage
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { help }
|
||||||
Reference in New Issue
Block a user