Skip to content

ZombieClient Class

The ZombieClient class extends the standard Client from discord.js. It acts as the kernel that orchestrates all your registered loaders.

Constructor

typescript
import ZombieClient from '@thezombiepl/zombieclient';
import { GatewayIntentBits } from 'discord.js';

const client = new ZombieClient({
    intents: [GatewayIntentBits.Guilds],
    ownerId: '123456789012345678', // Optional: Bot owner Discord ID
    loaders: [], // Optional: Array of ILoaders to register immediately
});

Properties

PropertyTypeDescription
colorstypeof BOT_COLORSA set of predefined hex colors for embeds.
ownerIdstring | undefinedThe ID of the bot developer. Used for commands with dev: true. Falls back to process.env.OWNER_ID.
loadersILoader[]An array of all currently registered plugins/loaders.

Methods

registerLoaders(loaders: ILoader[]): void

Registers an array of loaders. This does not initialize them, it only pushes them into the loaders array.

typescript
client.registerLoaders([commandLoader, eventLoader]);

init(): Promise<void>

Iterates through every registered loader and calls its asynchronous load() method. Must be called before client.login().

typescript
await client.init();

getLoader<T>(name: string): T | undefined

Retrieves a registered loader by its name property. Useful if one loader needs to access another loader at runtime.

typescript
const cmdLoader = client.getLoader<CommandLoader>('CommandLoader');

Wszelkie prawa zastrzeżone.