JSPM

  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q51394F
  • 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. I prefer using Babel so that I can use syntax that Node doesn't yet have but for the sake of usability I'll provide an example command using currently-native Node syntax:

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.

Links