slimcord.js

1.0.2 • Public • Published

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);

Package Sidebar

Install

npm i slimcord.js

Weekly Downloads

1

Version

1.0.2

License

GPL-3.0

Unpacked Size

52 kB

Total Files

12

Last publish

Collaborators

  • spaceboyross