1.0.50 • Published 2 years ago

icytea-command-handler v1.0.50

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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:

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

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

Javascript/NodeJS:

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 or Official Discord Developers Documentation for more information on slash commands.

Typescript:

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:

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:

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:

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) {}
};
1.0.22

2 years ago

1.0.21

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago

1.0.40

2 years ago

1.0.44

2 years ago

1.0.43

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.45

2 years ago

1.0.49

2 years ago

1.0.50

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.20

2 years ago

1.0.16

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.6

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago