Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rosscomputerguy/slimcord.js

A simple Discord Bot framework. Used for HaroBot and Lordgenome Discord Bots.
https://github.com/rosscomputerguy/slimcord.js

discord discord-bot discord-framework discord-js

Last synced: 13 days ago
JSON representation

A simple Discord Bot framework. Used for HaroBot and Lordgenome Discord Bots.

Awesome Lists containing this project

README

        

# slimcord.js

A simple Discord Bot framework. Used for HaroBot and Lordgenome Discord Bots.

## Example
This will **only** start the bot with no modules.
```js
const {Core} = require('slimcord.js');

let bot = new Core({});

bot.boot().catch(err => {
console.error(err);
process.exit(1);
});
```

## Example Module
```js
class MyModule {
constructor(core, options) {
this.core = core;
this.options = options;
}
metadata() {
return {
name: 'My Module',
desc: 'Hello, world.',
author: 'Me',
ver: '0.1.0',
url: 'https://example.com',
provides: [
'mymodule/mything'
]
};
}
async init() {
this.core.instance('mymodule/mything', (opts) => Object.assign({val: 'Hello, world'}, opts));
}
start() {
this.core.registerCommand('hello', {
description: 'Hello, world',
usage: 'hello',
run: (args, message, channel) => channel.send('Hello, world!')
});
}
destroy() {
delete this.core.commands['hello'];
}
}
```

### Adding the example module
Before your `bot.boot()` line, add this:
```js
bot.register(MyModule);
```