k1ker / eris-boiler

A Discord Bot boilerplate using JavaScript and the Eris library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eris-boiler

discord Maintainability Test Coverage Build Status

A Discord bot framework for JavaScript and the Eris library.

Installation

npm install eris-boiler

Talk to us!

The discord chat is the best place to communicate. We encourage using it for:

  • Asking for help
  • Asking if something is a bug
  • Proposing ideas
  • And anything else you can think of

Documentation

Class documentation can be found here

Usage

// index.js
const { DataClient } = require('eris-boiler')
const token = 'MY TOKEN'

const bot = new DataClient({
  token,
  qbOptions: {
    data: {
      connectionInfo: { // db connection info, as defined in simple-knex
        user: 'user',
        password: 'password',
        database: 'db name',
        host: 'ip'
      },
      client: 'mysql'
    }
  }
  sourceFolder: './src' // specify files live in ./src
  })

bot.connect()
// 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.

Contributing

Before starting work you should hash it out with us over on discord to make sure it is not already being worked on by someone else.

Check out our guidelines here.

Development

  1. Clone this repository
  2. Run npm install
  3. Add your token and other options
  4. Run npm run dev

About

A Discord Bot boilerplate using JavaScript and the Eris library

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%