slimcord.js
v1.0.2
Published
A simple Discord Bot framework. Used for HaroBot and Lordgenome Discord Bots.
Downloads
3
Maintainers
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.
const {Core} = require('slimcord.js');
let bot = new Core({});
bot.boot().catch(err => {
console.error(err);
process.exit(1);
});
Example Module
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:
bot.register(MyModule);