dscaffold
Version:
A TypeScript framework for scaffolding modular Discord bot projects with dynamic command and event loading
69 lines • 2.13 kB
TypeScript
import { Client, Collection } from 'discord.js';
export interface Command {
name: string;
description: string;
category?: string;
execute: (...args: any[]) => void;
data?: any;
}
export interface Event {
name: string;
once?: boolean;
execute: (...args: any[]) => void;
}
export declare class Dscaffold {
commands: Collection<string, Command>;
categories: Collection<string, Command[]>;
constructor();
/**
* Dynamically load commands from a directory
* @param client - Discord.js Client instance
* @param commandsPath - Path to commands directory (relative to project root)
* @param options - Loading options
*/
loadCommands(client: Client, commandsPath: string, options?: {
recursive?: boolean;
fileExtensions?: string[];
excludeDirs?: string[];
}): Promise<void>;
/**
* Dynamically load events from a directory
* @param client - Discord.js Client instance
* @param eventsPath - Path to events directory (relative to project root)
* @param options - Loading options
*/
loadEvents(client: Client, eventsPath: string, options?: {
recursive?: boolean;
fileExtensions?: string[];
excludeDirs?: string[];
}): Promise<void>;
/**
* Get command by name
*/
getCommand(name: string): Command | undefined;
/**
* Get commands by category
*/
getCommandsByCategory(category: string): Command[];
/**
* Get all categories
*/
getCategories(): string[];
private loadCommandsRecursive;
private loadEventsRecursive;
private isValidCommand;
private isValidEvent;
/**
* Reload commands (useful for development)
*/
reloadCommands(client: Client, commandsPath: string): Promise<void>;
/**
* Reload a specific command
*/
reloadCommand(commandName: string, commandsPath: string): Promise<boolean>;
private findCommandFile;
private findCommandFileRecursive;
}
export declare const dscaffold: Dscaffold;
export { dscaffold as default };
//# sourceMappingURL=dscaffold.d.ts.map