@deathhound/discord-handler v1.1.1
Discord-Handler
An NPM package to handle Commands and Events. Compatible with Discord.Js (v12-v13)
Installation
npm i @deathhound/discord-handler
Documentation
Classes
HandlerClient
constructor(ClientOptions, HandlerOptions)
Properties
eventHandler(EventHandler) - The Events Handler for this ClientcommandHandler(CommandHandler) - The Commands Handler for this Clientprefix(String) - Command prefixclientOptions(HandlerOptions) - The Client's options
EventHandler
constructor(Client)
Properties
client(HandlerClient) - The Client that belongs to this Handler
Methods
registerEvents(Events): EventHandler - Register Events from the Specified array
Events(Event[]) - An array of Event Classes to register
registerEventsIn(EventsDirPath): EventHandler - Register Events from the Specified file path
EventsDirPath(String) - The absolute path to the events directory
CommandHandler
constructor(Client)
Properties
client(HandlerClient) - The Client that belongs to this Handler
Methods
registerCommands(Commands): CommandHandler - Register Commands from the Specified array
Commands(Command[]) - An array of Command Classes to register
registerCommandsIn(CommandsDirPath): CommandHandler - Register Commands from the Specified file path
CommandsDirPath(String) - The absolute path to the commands directory
Command
constructor(Client, CommandOptions)
Properties
name(String) - The command namedescription(String) - A description of the commandaliases(String[]) - A String array containing Command Alias namesclient(HandlerClient) - The Client this command is registered with
Methods
run(): any - Run the command (on the base Command, this will throw an error. You should overwrite this method in extended classes)
Event
constructor(Client, EventOptions)
Properties
name(String) - The event nameemit(String) - When this event should be run (possible values are 'on' or 'once')emitter(EventEmitter) - The object that will emit the event (usually will be the Client)client(HandlerClient) - The Client this event is registered with
Methods
run(): any - Run the event (on the base Event, this will throw an error. You should overwrite this method in extended classes)
TypeDefs
HandlerOptions
- Type:
object
Properties
prefix(String) - Command prefix. Defaults to!commandEditTime(Number) - Length of time after sending a message it can be edited to run a command. Defaults to30000owner(String | String[]) - Owner ID or array of owner IDs
CommandOptions
- Type:
object
Properties
name(String) - The command namedescription(String) - A description of the commandaliases(String[]) - A String array containing Command Alias names
EventOptions
- Type:
object
Propeties
name(String) - The event nameemit(String) - When this event should be run (possible values are 'on' or 'once')emitter(EventEmitter) - The object that will emit the event (usually will be the Client)