# icytea-command-handler

> A small module used to handle commands using DiscordJS.

Latest version **1.0.50** (published 2023-08-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install icytea-command-handler
pnpm add icytea-command-handler
yarn add icytea-command-handler
bun add icytea-command-handler
```

## 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 | 1.0.50 |
| Published | 2023-08-09 |
| First published | 2023-01-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 25.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | icytea |

## Links

- npm: https://www.npmjs.com/package/icytea-command-handler
- npm.io page: https://npm.io/package/icytea-command-handler

## Dependencies (5)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [path](https://npm.io/package/path.md) ^0.12.7
- [discord.js](https://npm.io/package/discord.js.md) ^14.9.0
- [language-handler](https://npm.io/package/language-handler.md) ^0.0.1
- [mongo-database-handler](https://npm.io/package/mongo-database-handler.md) ^0.0.14

## Recent versions

- 1.0.50 (latest) — 2023-08-09
- 1.0.49 — 2023-08-09
- 1.0.48 — 2023-08-09
- 1.0.47 — 2023-07-28
- 1.0.46 — 2023-07-26
- 1.0.45 — 2023-07-19
- 1.0.44 — 2023-07-19
- 1.0.43 — 2023-07-19
- 1.0.42 — 2023-07-19
- 1.0.41 — 2023-07-19
- 1.0.40 — 2023-07-19
- 1.0.39 — 2023-07-15
- 1.0.38 — 2023-07-15
- 1.0.37 — 2023-07-15
- 1.0.36 — 2023-07-13
- … 36 more at https://npm.io/package/icytea-command-handler/versions

## README

# icytea-command-handler

A small module used to handle commands using DiscordJS.

# Usage

## Initiate the module

To use this module, simply apply the code below.

Typesript:

```ts
import { CommandHandler } from "icytea-command-handler";

// Remember to put this code inside an async function.
await new CommandHandler(client, options).init();
```

Javascript/NodeJS:

```js
const { CommandHandler } = require("icytea-command-handler");

// Remember to put this code inside an async function.
await new CommandHandler(client, options).init();
```

## Creating a command

To create a command, look at this example. This package will utilize Discord's Slash commands. Please refer to [DiscordJS Documentation](https://discord.js.org) or [Official Discord Developers Documentation](https://discord.com/developers/docs/intro) for more information on slash commands.

Typescript:

```ts
import { CommandTemplate } from "icytea-command-handler";

// Replace "Help" with the name of the command you like.
export default class Help extends CommandTemplate {
	constructor() {
		super({
			data: {
				name: "help",
				description: "The help command.",
			}, // Fill in basic data of the command.
			ownerOnly: false,
			userPermissions: [], // Sets the user's permissions
			clientPermissions: [], // Sets the client's permissions
			callback: ({
				interaction,
				client,
				guild,
				member,
				user,
				options,
				channel,
				handler,
			}) => {
				// Execute the command.
			},
		});
	}
}
```

Javascript/NodeJS:

```js
const { CommandTemplate } = require("icytea-command-handler");

// Replace "Help" with the name of the command you like.
module.exports = class Help extends CommandTemplate {
	constructor() {
		super({
			data: {
				name: "help",
				description: "The help command.",
			}, // Fill in basic data of the command.
			ownerOnly: false,
			userPermissions: [], // Sets the user's permissions
			clientPermissions: [], // Sets the client's permissions
			callback: ({
				interaction,
				client,
				guild,
				member,
				user,
				options,
				channel,
				handler,
			}) => {
				// Execute the command.
			},
		});
	}
};
```

## Creating a feature

To create a feature, simply use this code below.

Typescript:

```ts
import { FeatureTemplate } from "icytea-command-handler";

// Replace "Feature" with the name of the feature you like.
export default class Feature extends FeatureTemplate {
	public static shared = new Feature();

	public async init(client: Client): Promise<void>;
}
```

Javascript/NodeJS:

```ts
const { FeatureTemplate } = require("icytea-command-handler");

// Replace "Feature" with the name of the feature you like.
module.exports = class Feature extends FeatureTemplate {
	static shared = new Feature();

	async init(client) {}
};
```

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