mirror of
https://github.com/litruv/DAdmin.git
synced 2026-07-24 02:36:11 +10:00
Try/catch on loading commands
This commit is contained in:
14
index.js
14
index.js
@@ -41,10 +41,16 @@ class Commands {
|
|||||||
loadcommands() {
|
loadcommands() {
|
||||||
fs.readdir("./commands/", function (err, items) {
|
fs.readdir("./commands/", function (err, items) {
|
||||||
for (var i = 0; i < items.length; i++) {
|
for (var i = 0; i < items.length; i++) {
|
||||||
var reqcommand = require('./commands/' + items[i])
|
try {
|
||||||
for (var z = 0; z < reqcommand.alias.length; z++) {
|
var reqcommand = require('./commands/' + items[i])
|
||||||
var cachedcommand = new CachedCommand(reqcommand.alias[z], items[i])
|
for (var z = 0; z < reqcommand.alias.length; z++) {
|
||||||
client.cachedcommands.push(cachedcommand)
|
var cachedcommand = new CachedCommand(reqcommand.alias[z], items[i])
|
||||||
|
client.cachedcommands.push(cachedcommand)
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.log('error with:' + items[i])
|
||||||
|
console.error(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user