@ruben40000/slash-command-loader
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

Slash Command Loader

Easy to use and very flexible for complex slash command structures.

How It Works

Simply put, it loads files from given directory, and attempts to put them in either slash commands, slash commands with sub commands, or slash commands with subcommand groups:

directory/myslashdata.js => slash command directory/folder(s)/myslashdata.js => slash command with subcommands directory/folder(s)/folder(s)/myslashdata.js => slash command with subcommand groups

Create A Slash Command

Let's put this file in commands/ping.ts (or .js if you're using JavaScript):

import { SlashCommand } from "slash-command-loader"; 

export default new SlashCommand({
    api: {
        name: "ping",
        description: "A simple ping command!"
    }
})

How To Load Slash Commands

Usage 1

import { SlashCommandLoader } from "slash-command-loader";

// Put your commands directory in the first parameter
new SlashCommandLoader("./commands")
    .loadAsync()
    .then(
        manager => console.log(manager.toJSON()) // Array of application command data, this can be pushed directly to the Discord API
    )

Usage 2

import { SlashCommandLoader } from "slash-command-loader";

// Put your commands directory in the first parameter
new SlashCommandLoader("./commands")
    .load(
        manager => console.log(manager.toJSON()) // Array of application command data, this can be pushed directly to the Discord API
    )

Readme

Keywords

none

Package Sidebar

Install

npm i @ruben40000/slash-command-loader

Weekly Downloads

0

Version

2.0.2

License

ISC

Unpacked Size

63.8 kB

Total Files

112

Last publish

Collaborators

  • ruben40000