2024-11-19 20:05:19 -05:00
|
|
|
import { readdirSync } from 'node:fs'
|
2024-10-23 23:35:21 -04:00
|
|
|
|
2024-11-19 20:05:19 -05:00
|
|
|
const cmds = Object.create(null)
|
2024-10-26 13:32:34 -04:00
|
|
|
const bpl = readdirSync('commands')
|
|
|
|
|
2024-10-23 23:35:21 -04:00
|
|
|
for (const plugin of bpl) {
|
|
|
|
if (!plugin.endsWith('.js')) {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
const commandName = plugin.split('.js')[0]
|
2024-11-19 20:05:19 -05:00
|
|
|
import(`../commands/${plugin}`).then((pluginItem) => {
|
|
|
|
cmds[commandName] = pluginItem // For rejoining
|
|
|
|
if (cmds[commandName].aliases) {
|
|
|
|
for (const j in cmds[commandName].aliases) {
|
|
|
|
cmds[cmds[commandName].aliases[j]] = {
|
|
|
|
execute: cmds[commandName].execute,
|
|
|
|
alias: commandName,
|
|
|
|
usage: cmds[commandName].usage,
|
|
|
|
level: cmds[commandName].level,
|
|
|
|
hidden: true,
|
|
|
|
consoleIndex: cmds[commandName].consoleIndex
|
2024-10-26 13:32:34 -04:00
|
|
|
}
|
|
|
|
}
|
2024-11-19 20:05:19 -05:00
|
|
|
}
|
2024-10-23 23:35:21 -04:00
|
|
|
})
|
|
|
|
} catch (e) { console.log(e) }
|
|
|
|
}
|
|
|
|
|
|
|
|
export default cmds
|