JSPM

slash-commands-discord

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q33572F
  • License MIT

Discord Slash Commands with Interactions

Package Exports

  • slash-commands-discord

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (slash-commands-discord) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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