cumsystem
Version:
simple command system and command handler
62 lines (42 loc) • 1.18 kB
Markdown
A simple and powerful Discord.JS command system
`npm i cumsystem`
or
`npm i https://github.com/oatmealine/cumsystem`
then
```ts
const CommandSystem = require('cumsystem');
```
or
```ts
import * as CommandSystem from 'cumsystem';
```
```js
const Discord = require('discord.js');
const CommandSystem = require('./cumsystem');
let client = new Discord.Client();
let cs = new CommandSystem.System(client, '!');
client.on('message', m => cs.parseMessage(m));
client.on('ready', () => console.log('ready!'));
cs.on('error', (err, msg, cmd) => {
console.error(`got error while running ${cmd.name}:`);
console.error(err);
msg.channel.send(`got error!: ${err}\nyou should report this to the developer!`);
})
cs.addCommand(new CommandSystem.SimpleCommand('hi', () => {
return 'hello!';
})
.setCategory('core')
.setDescription('says hello back'));
cs.addCommand(new CommandSystem.SimpleCommand('say', (msg, content) => {
return content;
})
.setCategory('core')
.setDescription('says whatever you tell it to say')
.setOwnerOnly());
client.login(token);
```
[](https://oatmealine.github.io/cumsystem)