-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandler.js
More file actions
28 lines (18 loc) · 776 Bytes
/
handler.js
File metadata and controls
28 lines (18 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const fs = require("fs")
const ascii = require("ascii-table")
module.exports = (client) => {
let table = new ascii("Commands")
table.setHeading("Command", "Category", "Status")
fs.readdirSync("./commands/").forEach(dir => {
const commands = fs.readdirSync(`./commands/${dir}/`).filter(file => file.endsWith(".js"))
commands.forEach(file => {
let pull = require(`./commands/${dir}/${file}`)
if (!pull.name || typeof pull.run != "function") return table.addRow(file, dir, `❌`)
client.commands.set(pull.name, pull)
table.addRow(file, dir, "✅")
if (pull.aliases && Array.isArray(pull.aliases)) pull.aliases.forEach(alias => client.aliases.set(alias, pull.name))
client.dm.set(pull.name, pull.dm)
})
})
console.log(table.toString())
}