discord.handler.ts
TypeScript icon, indicating that this package has built-in type declarations

1.3.3 • Public • Published

Handler-discord.js Package!

import

npm i discord.handler.ts

Usage

const { CommandsBuilder } = require("discord.handler.ts");
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

Version

1.1.1

Soon

SlashCommandBuilder

Developers

Ziad#1768 only

Package Sidebar

Install

npm i discord.handler.ts

Weekly Downloads

1

Version

1.3.3

License

ISC

Unpacked Size

21 kB

Total Files

8

Last publish

Collaborators

  • devziadopo