1.1.1 • Published 1 year ago

dih4djs v1.1.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

Version Discord License

About

DIH4DJS is a powerful interaction handler module for the discord.js package.

This library is based off of the java package DIH4JDA with adaptations and improvements along with the obvious change (pst its in javascript).

Installation

DIH4DJS is built using the latest version of discord.js therefore requiring Node.js version 16.9.0 or newer

npm install dih4djs
yarn add dih4djs
pnpm add dih4djs

If you need help, don't hesitate to join our discord server to ask your questions or make suggestions.

Setup/Configuration

For a more indepth description on how to register commands feel free to look at the Wiki.

Setting up the handler

const { Client } = require('discord.js');
const { DIH4DJS } = require('dih4djs');

const client = new Client({
    intents: [YOUR_INTENTS]
});

const dih4djs = new DIH4DJS(client, {
    packages: ["./commands/"]
});

client.login("YOUR_TOKEN_HERE");

Creating your first Slash Command

How do you create a slash command? It's very simple! Just create a class in one of the specified package directories when initialising the handler which extends the SlashCommand class.

class HelloWorldCommand extends SlashCommand {
    constructor() {
        super(Commands.slash("hello", "world"), {
            // Sets the type of registration for this specific command
            registrationType: RegistrationType.Guild,
        });
    }

    /**
     * Runs whenever the command is executed.
     * @param {Client} client
     * @param {ChatInputCommandInteraction} interaction 
     */
    execute(client, interaction) {

    }
}

module.exports = HelloWorldCommand;

Contributing

When contributing please follow the steps provided: CONTRIBUTING