1.0.5 • Published 3 years ago

@koreanpanda/discord.js-framework v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

discord.js-framework

This is a framework just like discord.js commando, but is more simple, and easier to use.

How to install it?

$ npm i --save discord.js-framework

How to use it?

const {Framework} = require("discord.js-framework");

new Framework({
	token: "YOUR_BOT_TOKEN",
	prefix: "YOUR_BOT_PREFIX"
});

[
	`${__dirname}/commands`,
	`${__dirname}/events`
].forEach(x => Framework.LoadFolders(x));

Framework.startBot();

Unlike discord.js-commando, this framework is abusing the static properties, which enables itself to keep its instance, and be used in any file.

How to make commands?

you can make a folder, and have command files in it, or have the commands made in the index.js file. You can do it in anyway you would like.

Framework.addCommand({
	name: 'ping',
	description: 'Pong!',
	category: 'Miscellaneous',
	enable: true,
	invoke: (ctx) => {
		ctx.sendMessage('Pong');
	}
});

if you decide to make command files, then you would need to load them to allow the framework to access them, and load the commands.

[
	`${__dirname}/commands`
].forEach(x => Framework.LoadFolders(x));

This will load the files for you, so you don't have to go inot the hassle of making a function to do this.

What about events?

Yes same process as adding a command

Framework.addEvent({
	name: 'guildCreate',
	invoke: (guild) => {
		// do something
	}
});

TODO

  • Make Framework
  • Add functionality for adding commands, and events.
  • Add Default events and commands.

Command Structure

Prop nameTypeRequired
namestringYes
aliasesstring[]No
descriptionstringNo
usagestring[]No
categorystring[]No
enablebooleanNo
dmOnlybooleanNo
guildOnlybooleanNo
permissions{user?: PermissionString[], self?: PermissionString[]}No
preconditions((ctx: CommandContext) => boolean \| string[]No
invoke(ctx: CommandContext) => unknown;Yes

Event Structure

Prop nameType
namestring
invoke(ctx: CommandContext) => unknown;
1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago