63 lines
2.2 KiB
JavaScript
63 lines
2.2 KiB
JavaScript
const { commands } = require("../index")
|
|
const { EmbedBuilder, Colors } = require("discord.js")
|
|
|
|
module.exports.commands = [
|
|
{
|
|
name: "ping",
|
|
run: (ctx) => {
|
|
ctx.reply(`Pong!`)
|
|
},
|
|
hide: false,
|
|
description: "Check how fast bot will reply!"
|
|
},
|
|
{
|
|
name: "help",
|
|
run: (ctx) => {
|
|
// Constructing the embed
|
|
const embed = new EmbedBuilder()
|
|
// Setting author to the user
|
|
.setAuthor({
|
|
name: ctx.author.username,
|
|
iconURL: ctx.author.avatarURL(),
|
|
url: "https://git.squog.ru/entar/SquogAdmin"
|
|
})
|
|
// Setting color to white, obviously.
|
|
.setColor(Colors.White)
|
|
|
|
// Going over all command lists
|
|
commands.forEach(commandList => {
|
|
// Going over all commands
|
|
commandList.forEach(command => {
|
|
if (command.hide) {
|
|
return // Go to the next command if this one shouldn't show up
|
|
}
|
|
|
|
const arguments = command.arguments && command.arguments.slice()
|
|
|
|
// Changing
|
|
if (arguments) {
|
|
arguments.forEach((argument, index) => {
|
|
if (typeof argument == "object" || typeof argument == "function") {
|
|
arguments[index] = argument.name
|
|
} else {
|
|
arguments[index] = typeof argument
|
|
}
|
|
})
|
|
}
|
|
|
|
// Making a field out of command info
|
|
const field = {
|
|
name: command.name,
|
|
value: `Description: ${command.description || "None"}\nArguments: ${arguments || "None"}`
|
|
}
|
|
|
|
embed.addFields(field) // Jetbrains doesn't like this because it's not "any" for some reason?
|
|
})
|
|
})
|
|
|
|
// Sending the constructed message
|
|
ctx.reply({embeds: [embed]})
|
|
},
|
|
hide: true,
|
|
}
|
|
] |