Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

handler.djs

Package Overview
Dependencies
Maintainers
2
Versions
201
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handler.djs

A package to manage all discord bot Files

  • 2.6.39
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19
decreased by-90.95%
Maintainers
2
Weekly downloads
 
Created
Source
v

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

 $ npm init
 $ npm i discord.js
 $ npm i handler.djs
You can Handle Files with this package

SetUp

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

const { CommandBuilder } = require('handler.djs');

CommandBuilder.$N`ping`.$M((message) => {
    message.reply(`pong 🏓`);
});

CommandBuilder.$N`uptime`.$M((message) => {
    message.reply(`uptime: 1d 🌄`); 
});

events Setup

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

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 
}

Keywords

FAQs

Package last updated on 16 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc