Skip to content

Architecture

ZombieClient uses a plugin/loader pattern. The ZombieClient class is a thin kernel that extends discord.js Client. All functionality is added through loaders — classes implementing the ILoader interface.

Loaders Overview

  • FileLoader: Responsible for discovering and loading files from the disk. It includes an ignore system using *.ignore.json or # prefixes.
  • CommandLoader: Manages the lifecycle of slash and context menu commands. It deploys commands to Discord, handles interaction routing, and manages cooldowns.
  • EventLoader: Reads your event files and automatically registers them to the discord.js client with built-in error boundaries.

Creating Commands

Commands should be exported as objects satisfying the SlashCommand or ContextMenuCommand interfaces.

ts
import { ChatInputCommandBuilder, MessageFlags } from 'discord.js';
import type { SlashCommand } from '@thezombiepl/zombieclient/interfaces';

export default {
    data: new ChatInputCommandBuilder()
        .setName('ping')
        .setDescription('Check bot latency'),

    execute: async (client, interaction) => {
        await interaction.reply({
            content: `Pong! ${client.ws.ping}ms`,
            flags: MessageFlags.Ephemeral,
        });
    },
} satisfies SlashCommand;

Disabling Files

If you want the framework to ignore a specific command or event file, simply prefix the filename with a # (e.g., #ping.ts). The FileLoader will skip it automatically.

Wszelkie prawa zastrzeżone.