Skip to main content
Version: Next

CommandKit

CommandKit

Signature
class CommandKit extends EventEmitter {
public eventInterceptor!: EventInterceptor;
public static readonly createElement = createElement;
public static readonly Fragment = Fragment;
public readonly config: CommandKitConfiguration = {
defaultLocale: Locale.EnglishUS,
getMessageCommandPrefix: () => '!',
};
public readonly store = new Map<string, any>();
public readonly flags = new FlagStore();
public commandsRouter!: CommandsRouter;
public eventsRouter!: EventsRouter;
public commandHandler!: AppCommandHandler;
public eventHandler!: AppEventsHandler;
public plugins!: CommandKitPluginRuntime;
public events!: CommandKitEventsChannel;
public analytics!: AnalyticsEngine;
static instance: CommandKit | undefined = undefined;
constructor(options: CommandKitOptions = {})
start(token?: string | false) => ;
loadPlugins() => ;
started: void
setPrefixResolver(resolver: (message: Message) => Awaitable<string | string[]>) => ;
setDefaultLocale(locale: Locale) => ;
client: Client
setClient(client: Client) => ;
reloadCommands() => ;
reloadEvents() => ;
incrementClientListenersCount() => ;
decrementClientListenersCount() => ;
getAppDirectory() => ;
getPath(to: 'commands' | 'events') => ;
}
  • Extends: EventEmitter

eventInterceptor

createElement

property

Fragment

property

config

store

property

flags

property

commandsRouter

eventsRouter

property

commandHandler

eventHandler

plugins

events

analytics

instance

property
CommandKit | undefined

constructor

method
(options: CommandKitOptions = {}) => CommandKit

Create a new command and event handler with CommandKit.

start

method
(token?: string | false) =>

Starts the commandkit application.

loadPlugins

method
() =>

Loads all the plugins.

started

property

Whether or not the commandkit application has started.

setPrefixResolver

method
(resolver: (message: Message) => Awaitable<string | string[]>) =>

Sets the prefix resolver for the command handler.

setDefaultLocale

method
(locale: Locale) =>

Sets the default locale for the command handler.

client

property
Client

Get the client attached to this CommandKit instance.

setClient

method
(client: Client) =>

Sets the client attached to this CommandKit instance.

reloadCommands

method
() =>

Updates application commands with the latest from "commandsPath".

reloadEvents

method
() =>

Updates application events with the latest from "eventsPath".

incrementClientListenersCount

method
() =>

Increment the client listeners count.

decrementClientListenersCount

method
() =>

Decrement the client listeners count.

getAppDirectory

method
() =>

Path to the app directory. Returns null if not found. The lookup order is:

  • ./app
  • ./src/app

getPath

method
(to: 'commands' | 'events') =>