Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ziad-gg/handler.djs
handler.djs is a powerful tool designed to simplify the management of Discord.js bot files
https://github.com/ziad-gg/handler.djs
discord-js v14-discord-bot-template
Last synced: about 1 month ago
JSON representation
handler.djs is a powerful tool designed to simplify the management of Discord.js bot files
- Host: GitHub
- URL: https://github.com/ziad-gg/handler.djs
- Owner: ziad-gg
- Created: 2024-04-18T13:56:12.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-16T23:34:08.000Z (6 months ago)
- Last Synced: 2024-10-09T18:55:05.861Z (about 1 month ago)
- Topics: discord-js, v14-discord-bot-template
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/handler.djs
- Size: 8.03 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Introduction
handler.djs is a powerful tool designed to simplify the management of Discord.js bot files. It aims to enhance productivity by reducing the amount of time and code required to handle various aspects of a Discord bot, while also improving performance.
# Installing
```bash
$ npm init
$ npm i discord.js
$ npm i handler.djs
```You can Handle Files with this package
# SetUp
```js
const { Client } = require('discord.js');
const { Application } = require('handler.djs');const client = new Client({
intents: 3276799
});new Application(client, {
commands: __dirname.concat('/commands'),
events: __dirname.concat('/events'),
});client.Application.build();
client.login('Token');
```### commands Setup
```js
const { CommandBuilder } = require('handler.djs');CommandBuilder.$N`ping`.$M((message) => {
message.reply(`pong 🏓`);
});CommandBuilder.$N`uptime`.$M((message) => {
message.reply(`uptime: 1d 🌄`);
});
```### events Setup
```js
const { Client, Events } = require('discord.js');
const { EventBuilder } = require('handler.djs');EventBuilder.$N`${Events.ClientReady}`.$E(Execution).$O().$L();
/**
* @param {Client} client
*/
function Execution(client) {
console.log(client.user.tag);
};
```### validation Setup
```js
const { Message, ChatInputCommandInteraction } = require('discord.js');
const { ValidationBuilder } = require('handler.djs');ValidationBuilder.$E(Validation).$O(1).$end();
/**
* @param {{ message: Message, interaction: ChatInputCommandInteraction}} controller
* @param {() => {}} next
* @param {() => {}} end
*/
function Validation(controller, next, end) {
console.log(`First Validation Type: ${controller.interaction ? 'interaction' : 'message'}`);next(); // pass to next validation
console.log('First Validation: Passed');// end(); // stop command
}
```