slash-commands-discord

1.0.1 • Public • Published

slash-commands

By: ArviX

Discord Slash Commands and with interactions!

Init

npm install slash-commands-discord

Usage

Create Command

ONLY when deploying the command, if you do it multiple times, Discord will be bugged

let command = new CreateSlashCommand(client.token, client.user.id)
    command.setCommandName("say")
    command.setCommandDescription("Say avec le bot")
    command.addOption("text", "Texte", true)
    command.createCommand()

Interact with commands

Discord.js

client.ws.on("INTERACTION_CREATE", async data => {
    const interaction = new Interaction(data, client.token, client.user.id);
    if (interaction.command.name === "say") {
        await interaction.reply(interaction.command.options[0].value)
    }
})

Eris

client.on("rawWS", async(packet) => {
    if (packet.t === "INTERACTION_CREATE") {
        const data = packet.d;
        const interaction = new Interaction(data, client.token, client.user.id);
        if (interaction.command.name === "say") {
            await interaction.reply(interaction.command.options[0].value)
        }
    }
})

Package Sidebar

Install

npm i slash-commands-discord

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

19.4 kB

Total Files

7

Last publish

Collaborators

  • lordalex2015