discwork

💿 A Discord.js command framework. 🛠
Setup
The following will install discwork and Discord.js:
npm i -s discwork discord.js
For additional packages of Discord.js, see the Discord.js Installation page.
Usage
const Discord = require('discord.js')
const client = new Discord.Client()
var discwork = require('discwork')(client)
client.on('ready', () => {
console.log(`MyBot logged in as ${client.user.tag}!`);
})
discwork.add(/^mb!ping$/, (message, matches) => {
message.reply(`${client.ping}ms`)
})
discwork.add(/^mb!echo (.+)$/, (message, matches) => {
message.reply(matches[1])
})
discwork.done()
client.login('token')
Documentation
.add
Adds a command.
Parameters
- regex - The command RegExp, or an array of RegExpes
- action - The command handler function
Example
discwork.add(/^mb!ping$/, (message, matches) => {
message.reply(`${client.ping}ms`)
})
.done
Finishes the command list. Must be called after all commands were added.
Example
discwork.done()