1.1.2 • Published 3 years ago

@luvella/firework v1.1.2

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

Table of Contents

Install

npm install @luvella/firework

Example

See here for an example bot.

Or...

const Firework = require('@luvella/firework');
const bot = new Firework.Client('token');

const ping = new Firework.Command(bot, {
	name: 'ping',
	aliases: ['pong']
}).executor(function ({ msg, args }) {
	msg.channel.createMessage(`Ponged ${args[0]}!`);
	// Think of `this.bot` as `bot`
	this.bot.logger.debug('ponged');
});
bot.addCommand(ping);

bot.on('messageCreate', (msg) => {
	const prefix = '!';
	if (!msg.content.startsWith(prefix)) return;

	const args = msg.content.slice(prefix.length).trim().split(' ');
	const command = args.shift().toLowerCase();

	const cmd = bot.getCommand(command); // works with the name and aliases as well
	if (!cmd) return;

	cmd.run({ msg, args });
})

Links

License

Firework is licensed under the MIT license.
Read here for more info.

FOSSA Status

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago