2.1.0 • Published 12 months ago

discord.js-ext-command v2.1.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
12 months ago

discord.js-ext-command

discord.js-ext-command is command handler for discord.js

Installation

discord.js 14.0.0 or newer is required.

npm install discord.js-ext-command
yarn add discord.js-ext-command

Example

Text Command:

import {Command, Client, TextCommand} from "discord.js-ext-command";
import {CommandInteraction, GatewayIntentBits, Message, SlashCommandBuilder} from "discord.js";

const client = new DiscordCommands({
    prefix: "!"
}, {
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.DirectMessages,
        GatewayIntentBits.MessageContent
    ]
});

client.login("token");

@Command
class HelloWorldCommand implements TextCommand {
    public name = "hello";
    public args = 1;

    public execute(message: Message, args: string[]) {
        message.channel.send(`hello ${args[0]}!`);
    }
}

Slash Command:

import {Command, Client, InteractionCommand} from "discord.js-ext-command";
import {CommandInteraction, GatewayIntentBits, SlashCommandBuilder} from "discord.js";

const client = new DiscordCommands({
    prefix: "!"
}, {
    intents: [
        GatewayIntentBits.Guilds
    ]
});

client.login("token");

@Command
class HelloWorldCommand implements InteractionCommand {
    data = new SlashCommandBuilder()
        .setName("test")
        .setDescription("test")

    execute(interaction: CommandInteraction) {
        interaction.reply({
            content: "test"
        });
    }
}
2.1.0

12 months ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago