JSPM

  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q51505F
  • License MIT

Yet Another Modular Discord Bot Framework: A somewhat simple framework for quickly creating new Discord.js bots.

Package Exports

  • yamdbf

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (yamdbf) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

YAMDBF: Yet Another Modular Discord Bot Framework

Discord npm David CircleCI

NPM

A Discord.js-based Discord Bot framework to be used as a base for quick bot development.

Usage of the framework is pretty simple. Run npm install --save yamdbf in your project folder, create a folder to put commands in, create a file named config.json that looks like this:

{
    "token": "token",
    "owner": ["ownerid"]
}

Then fill in the values and create a basic bot script.

A basic bot script will look something like this

const Bot = require('yamdbf').Bot;
const config = require('./config.json');
const path = require('path');
const bot = new Bot({
    name: 'bot',
    token: config.token,
    config: config,
    selfbot: false,
    version: '1.0.0',
    statusText: 'try @mention help',
    commandsDir: path.join(__dirname, 'commands')
}).start();

And that's all it takes! Just that and you have a fully functioning bot with the base commands available in the framework. After that you'll just need to write your own commands. Here's an example command:

let Command = require('yamdbf').Command;

exports.default = class Ping extends Command
{
    constructor(bot)
    {
        super(bot, {
            name: 'ping',
            aliases: ['p'],
            description: 'Pong!',
            usage: '<prefix>ping',
            extraHelp: 'A basic ping/pong command example.',
            group: 'example',
            guildOnly: false,
            permissions: [],
            roles: [],
            ownerOnly: false
        });
    }

    action(message, args, mentions, original) // eslint-disable-line no-unused-vars
    {
        message.reply('Pong!');
    }
};

It should be noted that command actions have access to the Discord.js Client instance via this.bot.

That's about it for creating a bot and adding commands. If you don't want to have to copy and paste templates all the time or look at them for examples, a Yeoman generator has been written that can be used for creating new bot projects and new commands from the command line. It's very handy!

Links