@ad1m/djb
Version:
A streamlined library for creating Discord bots with Discord.js, featuring a simple command and event handler structure.
85 lines (78 loc) • 2.65 kB
TypeScript
import { BitFieldResolvable, PermissionsString, OmitPartialGroupDMChannel, Message, Collection, AnySelectMenuInteraction, ModalSubmitInteraction, ButtonInteraction, Client, ClientOptions } from 'discord.js';
interface CommandConfig {
description: string;
args?: CommandArg[];
permissions?: BitFieldResolvable<PermissionsString, number>[];
roles?: string[];
ownersOnly?: boolean;
}
declare enum CommandArgType {
STRING = 0,
NUMBER = 1,
BOOLEAN = 2,
TIME = 3,
USER = 4,
MEMBER = 5,
ROLE = 6,
CHANNEL = 7
}
interface CommandArg {
name: string;
description: string;
type?: CommandArgType;
required?: boolean;
}
type CommandExecute = (client: DJBClient, message: OmitPartialGroupDMChannel<Message>, commandName: string, args: Collection<string, any>) => void;
type Command = {
config: CommandConfig;
execute: CommandExecute;
};
type SelectMenuConfig = {};
/**
* Select menu execute function
*/
type SelectMenuExecute = (client: DJBClient, values: AnySelectMenuInteraction["values"], interaction: AnySelectMenuInteraction) => void;
type SelectMenu = {
config?: SelectMenuConfig;
execute: SelectMenuExecute;
};
type ModalConfig = {};
/**
* Modal execute function
*/
type ModalExecute = (client: DJBClient, fields: ModalSubmitInteraction["fields"], interaction: ModalSubmitInteraction) => void;
type Modal = {
config?: ModalConfig;
execute: ModalExecute;
};
type ButtonConfig = {};
/**
* Button execute function
*/
type ButtonExecute = (client: DJBClient, interaction: ButtonInteraction) => void;
type Button = {
config?: ButtonConfig;
execute: ButtonExecute;
};
type ClientConfig = {
prefix: string;
description?: string;
ownerIds?: string[];
};
interface DJBClientOptions {
mongoDb?: boolean;
}
declare class DJBClient extends Client {
config?: ClientConfig;
cache: Collection<string, any>;
commands: Collection<string, Command>;
selectMenus: Collection<string, SelectMenu>;
modals: Collection<string, Modal>;
buttons: Collection<string, Button>;
djbOptions?: DJBClientOptions;
constructor(options: ClientOptions, djbOptions?: DJBClientOptions);
private setupClient;
private setupDatabase;
start(): void;
}
export { type ButtonConfig as B, type ClientConfig as C, DJBClient as D, type ModalConfig as M, type SelectMenuConfig as S, type CommandConfig as a, CommandArgType as b, type CommandArg as c, type CommandExecute as d, type Command as e, type SelectMenuExecute as f, type SelectMenu as g, type ModalExecute as h, type Modal as i, type ButtonExecute as j, type Button as k };