0.1.5 • Published 6 years ago

accord.js v0.1.5

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

Accord.js

Travis Coveralls npm

Accord is the library that will allow you to write your discord bot with serenity.

How do you ask? By trying to have the simplest possible API while giving great control of what your bot will do.

Documentation

The documentation is available in docs/

Usage

Here is an example of how to use Accord.js.

import { bootstrapBot, createCommand } from 'accord.js';
import { Client } from 'discord.js';

const discordToken = process.env.DISCORD_TOKEN || '';
const bot = new Client();

bot.on('ready', () => console.log('Bot connected'));
bot.login(discordToken);

const pingCommand = createCommand('ping', message => new Promise(resolve =>
  setTimeout(() => resolve({
    content: 'PONG',
    recipient: message.channel,
  }), 3000),
));

const reverseCommand = createCommand(/reverse (.*)/, (message, stringToReverse) => ({
  content: stringToReverse.split('').reverse().join(''),
  recipient: message.channel,
}));

const subscription = bootstrapBot(bot, [ pingCommand, reverseCommand ], '!');
0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago