discord.js-handler
Simple yet powerful handler for discord.js.
Features 📋
- Organized and class-oriented
- CommonJS and EcmaScript friendly
- Typings included
- Categories and recursive events and commands
Installation 🔥
npm 🐿️
npm install discord.js-handler
Yarn 🧶
yarn add discord.js-handler
Usage 🚀
Activation example ✔️
const Client = ;const Handler = ; const handler = client: token: 'TOKEN' eventsFolder: './events' commandsFolder: './commands'; try handler; handler; catch e console;
Event example 📡
const EventListener = ; moduleexports = { super event: 'message' listener: async { try await handler; await message; catch e console; } ; };
Command example 📡
const CommandListener = ; moduleexports = { const parameters = aliases: 'ping' 'pong' listener: async { try await message; await message; catch e console; } ; superparameters; };
Warnings ⚠️
When using commands with the handler, you must specify the commands' folder in the handler settings (commandsFolder
parameter) and have a message event, in which you call the importCommands
method from the handler instance (Handler.importCommands()
), otherwise the commands will not be called (As specified in the event example)
This happens because the handler needs a prefix, and it must be defined on the message event, because you could want the prefix to be dynamic (change from guild to guild)
Login and token management done by the handler is completely optional. If you prefer doing so, create the client instance and login by yourself using discord.js
Feedback 👥
If you want to report an error or give a suggestion, please refer to the following links
License 📝
MIT - hSel3triK