Skip to content

v3 Beta

Pre-release
Pre-release
Compare
Choose a tag to compare
@alex-taxiera alex-taxiera released this 31 Jul 23:48

v3 is NEAR

Get ready.

NPM

Major work has been done to rework this as an NPM package, documentation and examples are to come once this gets finalized

How To

Installation

npm i alex-taxiera/eris-boiler#83668ed

Usage

NOTE: This has only been tested with MySQL/MariaDB, but should also work with PostgreSQL

// index.js
require('dotenv').load() // load .env
const { DataClient } = require('eris-boiler')

const bot = new DataClient({sourceFolder: './src'}) // specify files live in ./src
bot.connect()
// .env
TOKEN=XXX
DB_NAME=my-bot
DB_USER=user
DB_PASS=pass
// src/commands/echo.js
const { Command } = require('eris-boiler')
// commands must export a function bringing bot into the constructor
module.exports = (bot) => new Command(
  bot,
  {
    name: 'echo', // name of command
    description: 'copy that',
    run: async ({ params }) => params.join(' ') // functionality of command
    // list of things in object passed to run: bot (DataClient), msg (Message), params (String[])
  }
)
// src/events/presenceUpdate.js
// event files should be named by event name
const { Event } = require('eris-boiler')

module.exports = new Event({
  name: 'presenceUpdate', // name should match event name
  run: (bot, newMember, oldMember) => bot.logger.warn('something changed')
  // bot is bound to all events, so bot will be the first parameter in addition to any parameters passed in from Eris
})

That should cover most things anyone starting out should need to know.