error handling for events & commands
This commit is contained in:
parent
a78e759ba9
commit
204977952d
1 changed files with 12 additions and 2 deletions
14
index.js
14
index.js
|
@ -61,7 +61,12 @@ client.aliases = new Discord.Collection()
|
|||
const init = async () => {
|
||||
// Load events
|
||||
fs.readdir('./events', (err, files) => {
|
||||
if (err) {}
|
||||
if (err) {
|
||||
client.logger.error('Failed to get files in events directory! ' + err);
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
client.logger.info(`Loading ${files.length} events.`)
|
||||
files.forEach(file => {
|
||||
if (!file.endsWith('.js')) {
|
||||
|
@ -74,7 +79,12 @@ const init = async () => {
|
|||
|
||||
// Load commands
|
||||
fs.readdir('./commands', (err, files) => {
|
||||
if (err) {}
|
||||
if (err) {
|
||||
client.logger.error('Failed to get files in commands directory! ' + err);
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
client.logger.info(`Loading ${files.length} commands.`)
|
||||
files.forEach(file => {
|
||||
if (!file.endsWith('.js')) {
|
||||
|
|
Loading…
Reference in a new issue