# slash-commands-discord

> Discord Slash Commands with Interactions

Latest version **1.0.1** (published 2021-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install slash-commands-discord
pnpm add slash-commands-discord
yarn add slash-commands-discord
bun add slash-commands-discord
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-02-25 |
| First published | 2021-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 19 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ArviX#8443 |
| Maintainers | lordalex2015 |
| Keywords | Discord.js, Discord, Eris, Slash-Commands, LordAlex2015 |

## Links

- npm: https://www.npmjs.com/package/slash-commands-discord
- Repository: https://github.com/LordAlex2015/slash-commands
- Homepage: https://github.com/LordAlex2015/slash-commands#readme
- Issues: https://github.com/LordAlex2015/slash-commands/issues
- npm.io page: https://npm.io/package/slash-commands-discord

## Dependencies (1)

- [centra](https://npm.io/package/centra.md) ^2.4.2

## Recent versions

- 1.0.1 (latest) — 2021-02-25
- 1.0.0 — 2021-02-25

## 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**
```js
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
```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
```js
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)
        }
    }
})
```

---
_Source: https://npm.io/package/slash-commands-discord · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
