# slashers

> - **npm i discord.js@dev** - **node.js v14 or higher** ## ➕ **Advantages:** - **Easy to use.** - **Good examples.** - **Makes your job easier.**

Latest version **1.2.1** (published 2021-08-04) · 0 weekly downloads

## Install

```sh
npm install slashers
pnpm add slashers
yarn add slashers
bun add slashers
```

## 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.2.1 |
| Published | 2021-08-04 |
| First published | 2021-08-03 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | darkeroverkill |

## Links

- npm: https://www.npmjs.com/package/slashers
- npm.io page: https://npm.io/package/slashers

## Recent versions

- 1.2.1 (latest) — 2021-08-04
- 1.2.0 — 2021-08-04
- 1.1.7 — 2021-08-04
- 1.1.6 — 2021-08-04
- 1.1.5 — 2021-08-03
- 1.1.3 — 2021-08-03
- 1.1.2 — 2021-08-03
- 1.1.1 — 2021-08-03
- 1.1.0 — 2021-08-03
- 1.0.2 — 2021-08-03
- 1.0.1 — 2021-08-03
- 1.0.0 — 2021-08-03

## README

# **🎱 Slasher 🎱**
## ⚓ **Requires:**
- **npm i discord.js@dev**
- **node.js v14 or higher**
## ➕ **Advantages:**
- **Easy to use.**
- **Good examples.**
- **Makes your job easier.**

## 📚 **Getting Started:**
### Example of the main file with single dir:
```
const Discord = require('discord.js');
const slashers = require('slashers');
const client = new Discord.Client();

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

slashers.setPathSingle('path to slash folder', client)

client.on('interaction', async (interaction) => {
slashers.run(client, interaction);
});

client.login('token');
```

### Example of the main file with subfolder dirs:
```
const Discord = require('discord.js');
const slashers = require('slashers');
const client = new Discord.Client();

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

slashers.setPathDirs('path to slash folder', client)

client.on('interaction', async (interaction) => {
slashers.run(client, interaction);
});

client.login('token');
```

### Example of creating a very basic guild slash command using this package:
```
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  slashers.createGlobal({
	  name: 'name',
	  description: 'description',
	  client: client,
  })
});
```

### Example of creating a very basic global slash command using this package:
```
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  slashers.createGuild({
	  guildId: 'guild id',
	  name: 'name',
	  description: 'description',
	  client: client,
  })
});
```

### Example of creating a guild only slash command:
```
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  const data = {
	name: 'ping',
	description: 'Replies with Pong!',
	};
    const command = await client.guilds.cache.get('guild id')?.commands.create(data);
});
```
### Example of creating a global slash command:
**⚠️️ These take 1 hour to apply! ⚠️**
```
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  const data = {
	name: 'ping',
	description: 'Replies with Pong!',
	};
    const command = await client.application?.commands.create(data);
});
```

### Example of a slash command file:
```
module.exports = {
	name: 'ping',
	async run(interaction) {
	    interaction.reply("Pong!");
	},
};
```

### Functions:
- **<slashes>.setPathDirs** - **Set the path for slash commands with subfolders.**
- **<slashes>.setPathSingle** - **Set the path for slash commands without subfolders.**
- **<slashes>.run** - **Run a slash command file.**
- **<slashes>.createGuild** - **Create a basic guild slash command**

## Useful Links:
### [Discord Support Server](https://discord.gg/SHkADzpN73)
### [Discord.js Slash Commands Guide](https://deploy-preview-680--discordjs-guide.netlify.app/interactions/registering-slash-commands.html)

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