djs-slash-cmd-handler
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

djs-slash-cmd-handler

About

djs-slash-cmd-handler is a small module made to simplify the tasks with the slash commands.

Installation

discord.js 14.2.0 or newer is required.

npm i --save djs-slash-cmd-handler

Example usage

Registering a command

const { SlashCommandBuilder } = require('discord.js');
const { CommandDeployer } = require('djs-slash-cmd-handler');

const deployer = new CommandDeployer('<BOT_TOKEN>', '<APPLICATION_ID>');
const command = new SlashCommandBuilder()
  .setName('ping')
  .setDescription('returns pong')

deployer.set(command);
deployer.deploy();

Handling commands with a bot

const { Client } = require('discord.js');
const { CommandHandler } = require('djs-slash-cmd-handler');

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

handler.set('ping', (interaction) => {
  interaction.reply('pong');
});

client.login('<BOT_TOKEN>');

Links

Help

If you don't understand something, have a question or just want to know which is the right path, don't hesitate to join our server.

Readme

Keywords

Package Sidebar

Install

npm i djs-slash-cmd-handler

Weekly Downloads

0

Version

1.2.2

License

MIT

Unpacked Size

21.3 kB

Total Files

11

Last publish

Collaborators

  • rex-aliis