#FileLoader Usage
TypeScript
import { Bot, Intents, FileLoader, Command } from 'discordkit'; import { join } from 'path'; const client = new Bot({ intents: [ Intents.Guilds ] }); // If you are using ts, you need to provide generics. // Command or Event const loader = new FileLoader<Command>(join(__dirname, './commands')); loader.on('error', err => { console.error('FileLoader Error', err); }); loader.on('load', file => { console.log('Command loaded:', file.name); }); loader.on('finish', time => { client.addCommand(loader.files); console.log(`Loaded ${loader.files.length} commands in ${time}ms`); client.init('super-secret-token'); });