Skip to content

Commit 0a13fdc

Browse files
author
James Kerrane
committed
Add logging for command loading
1 parent 9bae58b commit 0a13fdc

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

index.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,18 @@ client.commands = new Discord.Collection();
2525
// Get command files
2626
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
2727

28-
for (const file of commandFiles) {
29-
const command = require(`./commands/${file}`);
28+
console.log(commandFiles.isArray);
29+
30+
console.log("Attemping to load commands in the commands folder.")
31+
32+
commandFiles.forEach(function (file, i) {
33+
const command = require(`./commands/${file}`);
34+
console.log(`${file} Loaded (${i + 1}/${commandFiles.length})`);
3035

3136
// set a new item in the Collection
3237
// with the key as the command name and the value as the exported module
3338
client.commands.set(command.name, command);
34-
}
35-
39+
});
3640

3741

3842
// when the client is ready, run this code
@@ -62,7 +66,7 @@ client.on('message', async (message) => {
6266
// child_process commands go here
6367

6468
// ignore messages without prefixes and messages from the bot itself
65-
if (!message.content.startsWith(process.env.PREFIX) || message.author.bot) return;
69+
if (!message.content.startsWith(process.env.PREFIX) || message.author.bot) return;
6670

6771
// slices of the prefix and splits message into an array
6872
const args = message.content.slice(process.env.PREFIX.length).split(' ');

0 commit comments

Comments
 (0)