2024-08-12 05:13:32 -04:00
|
|
|
const fs = require('fs')
|
|
|
|
const cmds = Object.create(null)
|
|
|
|
const bpl = fs.readdirSync('./commands')
|
2024-08-22 07:34:39 -04:00
|
|
|
for (const plugin of bpl) {
|
|
|
|
if (!plugin.endsWith('.js')) {
|
2024-08-12 05:13:32 -04:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
try {
|
2024-08-22 07:34:39 -04:00
|
|
|
const commandName = plugin.split('.js')[0]
|
|
|
|
cmds[commandName] = require(`../commands/${plugin}`)
|
2024-08-12 05:13:32 -04:00
|
|
|
if (cmds[commandName].level === undefined) {
|
|
|
|
cmds[commandName].level = 0
|
|
|
|
}
|
|
|
|
if (cmds[commandName].aliases) {
|
2024-08-22 07:34:39 -04:00
|
|
|
for (const alias of cmds[commandName].aliases) {
|
|
|
|
cmds[alias] = {
|
2024-08-12 05:13:32 -04:00
|
|
|
execute: cmds[commandName].execute,
|
|
|
|
alias: commandName,
|
|
|
|
usage: cmds[commandName].usage,
|
|
|
|
level: cmds[commandName].level,
|
|
|
|
hidden: true,
|
|
|
|
consoleIndex: cmds[commandName].consoleIndex
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (e) { console.log(e) }
|
|
|
|
}
|
|
|
|
module.exports = cmds
|