# jommand

> Jommand - JS Command library with discord.js like discordpy.ext

Latest version **1.0.6** (published 2021-06-14) · MIT license · 0 weekly downloads

## Install

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

## 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.6 |
| Published | 2021-06-14 |
| First published | 2021-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | TreeKR |
| Maintainers | namutree0345 |

## Links

- npm: https://www.npmjs.com/package/jommand
- Repository: https://github.com/NamuTree0345/jommand
- Homepage: https://github.com/NamuTree0345/jommand#readme
- Issues: https://github.com/NamuTree0345/jommand/issues
- npm.io page: https://npm.io/package/jommand

## Dependencies (1)

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

## Recent versions

- 1.0.6 (latest) — 2021-06-14
- 1.0.5 — 2021-06-14
- 1.0.4 — 2021-06-14
- 1.0.3 — 2021-06-14
- 1.0.2 — 2021-06-13
- 1.0.1 — 2021-06-13
- 1.0.0 — 2021-06-12

## README

# Jommand
JS Command Library like discordpy.ext (with Discord.JS)
- Referenced some structure of [monun/kommand](https://github.com/monun/kommand)

## Example Code

### Example
```js
// Import Jommand
const { Jommand, Command, BooleanArgument, IntArgument, CommandArgument } = require('jommand')
// Jommand Init
const jommand = new Jommand('y!' /* prefix */)
const discord = require('discord.js')
const client = new discord.Client()

// Register command
// Use CommandArgument for String Argument
jommand.createCommand(new Command('test', (msg, ctx) => {
    // Excepted output
    // Input: y!test true 7777 hello_world!
    // Output: 
    msg.channel.send(`boolarg: ${ctx.parseArgument('arg1')}, intarg: ${ctx.parseArgument('arg2')}, stringarg: ${ctx.parseArgument('arg3')}`)
}, [new BooleanArgument('arg1'), new IntArgument('arg2'), new CommandArgument('arg3')]))

// Remove
// jommand.removeCommand('test')

client.on('message', (msg) => {
    // bind Jommand to event handler
    jommand.executeCommand(msg)
})

client.login(require('./config.json').token)
```

### Custom Argument

```js
// ...
class HobulhoArgument extends CommandArgument {

    checkValid(rawData) {
        return (rawData === 'mintchoco' || rawData === 'pineapplePizza')
    }

    parseData(rawData) {
        // Excepted output
        // Input: ... mintchoco ...
        // Output: false
        // Input: ... pineapplePizza ...
        // Output: true
        // Input: ... greentea ...
        // Output: (ERROR: UNEXCEPTED ARGUMENT)

        return rawData === 'mintchoco' ? false : true
    }

}
// ...
```

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