Socket
Socket
Sign inDemoInstall

handler-discord-js

Package Overview
Dependencies
99
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    handler-discord-js

A simple handler code with discord.js.


Version published
Maintainers
1
Created

Readme

Source

Handler-discord.js Package!

import

npm i handler-discord-js

Usage

const { CommandsBuilder } = require("handler-discord-js");
const app = new CommandsBuilder({
  client: client,
  eventsFolder: "./events",
  commandsFolder: "./commands",
});

Examples

const { Collection } = require('discord.js');
client.commands = new Collection();

app.loadEvents();
app.loadCommands();();

Events Files

module.exports = {
  name: "<events name>",
  execute(client) {
    //Code
  },
};

Events Examples

const prefix = "!";

module.exports = {
  name: 'messageCreate',
  execute(message, client) {
    if (!message.content.startsWith(prefix) || message.author.bot) return;
    const args = message.content.slice(prefix.length).trim().split(/ +/);
    const command = args.shift().toLowerCase();
    if (!client.commands.has(command)) return;
    try {
      client.commands.get(command).execute(client, message, args);
    } catch (error) {
      console.error(error);
      message.reply('there was an error trying to execute that command!');
    }
  },
}

Command Files

module.exports = {
  name: 'ping',
  async execute(message, args, client) {
    message.channel.send("pong!")
  }
}

Examples For All

project photo

My Server: Robux Factory

Version

1.1.1

Soon

SlashCommandBuilder

Developers

Slayver#0680, Ziad#1768

Keywords

FAQs

Last updated on 10 Aug 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc