2.0.2 • Published 2 years ago

@ruben40000/slash-command-loader v2.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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
    )
1.0.2

2 years ago

2.0.2

2 years ago

1.0.5

2 years ago

2.0.1

2 years ago

1.0.4

2 years ago

2.0.0

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago