# @mrmythical/discord.js-helper

> A package to help with developing in discord.js

Latest version **2.0.1** (published 2022-03-30) · 0 weekly downloads

## Install

```sh
npm install @mrmythical/discord.js-helper
pnpm add @mrmythical/discord.js-helper
yarn add @mrmythical/discord.js-helper
bun add @mrmythical/discord.js-helper
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2022-03-30 |
| First published | 2022-03-22 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 24.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | mrmythical |
| Keywords | discord, api, discord-api, discord.js, discordjs, helper |

## Links

- npm: https://www.npmjs.com/package/@mrmythical/discord.js-helper
- Homepage: https://github.com/MrMythicalYT/discordjs-helper#readme
- npm.io page: https://npm.io/package/@mrmythical/discord.js-helper

## Dependencies (1)

- [discord.js](https://npm.io/package/discord.js.md) ^13.6.0

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2022-03-30
- 2.0.0 — 2022-03-29
- 1.2.1 — 2022-03-23
- 1.2.0 — 2022-03-23
- 1.1.4 — 2022-03-22
- 1.1.3 — 2022-03-22
- 1.1.2 — 2022-03-22
- 1.1.1 — 2022-03-22
- 1.1.0 — 2022-03-22
- 1.0.9 — 2022-03-22
- 1.0.8 — 2022-03-22
- 1.0.7 — 2022-03-22
- 1.0.6 — 2022-03-22
- 1.0.5 — 2022-03-22
- 1.0.4 — 2022-03-22
- … 4 more at https://npm.io/package/@mrmythical/discord.js-helper/versions

## README

# discord.js-helper
Easy developing in discord.js

# Bugs
Please go to the issues page on github to submit a bug

Example:
```js
const { Discord, Client, Command } = require("@mrmythical/discord.js-helper")
const { Intents } = Discord
const client = new Client({
    intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
    autoListen: true
})

client.prefix = '!'
const command = new Command(client, {
    name: "test",
    aliases: ["t"]
})
command.on("execute", ({ msg }) => {
  data.msg.reply("Success!")
})

client.on("ready", () => console.log("Ready"))

client.login(token)
```
Sending `!test` or `!t` should send back `Success!` with the bot!
---
You can contribute on the [GitHub repository](https://github.com/MrMythicalYT/discordjs-helper)

# Slash command support is here with v2!
```js
const { Client, Discord, SlashCommand } = require(".");
const { Intents } = Discord;
const client = new Client({
    intents: [Intents.FLAGS.GUILDS],
    autoListen: true
});

const command = new SlashCommand(client, {
    name: "test",
    options: [{
        name: "test",
        description: "A test",
        type: "STRING"
    }],
    description: "test cmd"
})
client.on("ready", async () => {
  // ONLY RUN THIS ONCE WHEN YOU MODIFY COMMANDS OR YOU WILL LIKELY GET RATELIMITED
    await client.slashCommands.postAll(guildId) // guildId is not required, not passing guildId will make it post to global comands
    console.log("ready")
})

command.on("execute", async ({ interaction }) => {
    await interaction.reply(`This is a reply to the ${interaction.commandName} slash command!`)
})

client.login(token);
```
# Docs?
There are no docs yet, but hopefully this helps:

## Client
Regular discord.js with a few changes, including `autoListen` in `ClientOptions` and being able to set the prefix. There is also `.commands` which returns a `CommandManager`

## Args
Args are like js maps, but are readonly. They are mapped by name and user input.

## Command and CommandManager
Commands are easy to use and auto listen if set in client options. `autoListen` in the client options is true by default. CommandManagers help you with managing commands, like listing them, deleting them, etc.

## SlashCommand and SlashCommandManager
SlashCommands are almost like Commands, but aren't as flexible as message commands and you can access them on Discord by typing `/`. SlashCommandManagers hold these commands. Please only run the methods responsibly. Only run them if needed, or you may get ratelimited

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