I am trying to iterate through a folder of command files to make a help command for a discord bot. This is my code so far.
module.exports = {
name: 'help',
description: 'Lists current commands.',
execute(message) {
//was the first time i made something interesting out of a for loop
if (message.content.toLowerCase() === '$help') {
const commands = 'C:/Bot/commands';
const Discord = require('discord.js');
const helpEmbed = new Discord.MessageEmbed()
.setTitle("Commands")
.setColor(0x6e7175)
.setFooter('Provided by Echo', 'https://cdn.discordapp.com/avatars/748282903997186178/6288e1f487e111b211aa9966c583d948.png?size=128')
.setTimestamp()
for (i of commands) {
let title = i.name
let value = i.description
helpEmbed.addField(title, value)
}
message.channel.send(helpEmbed)
}
}
}
C:/Bot/commands is the folder in which all the commands are stored, at the moment i.name and i.description are undefined. What's the issue here?