fisherman-discord.js
v1.0.7
Published
Fisherman: A Discord command router, inspired by expressjs | Discord.js library base
Downloads
34
Maintainers
Readme
Fisherman - Discord.js
npm install --save fisherman-discord.js
Copyright © 2017, Simon Sassi
What is Fisherman
a lightweight, fast, and powerful discord command router written in javascript standard style and inspired by expressjs
Fisherman features :
Use native RegExp to match with the prefixe(s)
Powerful middleware/plugin chain using fastfall
Entirely written in javascript language style
FisherCodes (status handling) events, same as http codes handling
Request/Response/Router prototypes can be edited from everywhere
Bunch of middlewares, like bot typing, embed compatibility, command loader etc...here
Documentation with a tutorial
Inspired by expressjs and klein, express command creation style with request/response statements (see example below), to be simple
Promised commands, custom pattern matching with patternCallback option etc...
var bot = new fisherMan.Fisherman({ prefixes: ['fish!'] }) // creating a client, with the prefixe "fish!"
bot.use(middleware) // appending a middleware/plugin to fisherman
var register = bot.createRegister('test', 'test') //creating a register named "test"
console.log('registerCreated')
register.textCommand('test', null, function (req, res) { // registering a new command, named "test"
//This command will be trigerred by "fish!test". It is only available in a text channel.
res.send(`Command infos:\nName: ${req.command.name}\nRegister name: \`${req.command.register.name}\`\nTotal command count in the fisherman client: ${req.client.commands.size}`, { embed: { description: 'This request was made through the fishman project' } })
})
register.textCommand('ping', null, function (req, res) { //registering a new command named "ping"
var current = Date.now()
res.send('Pinging......').then((message) => {
message.edit((Date.now() - current) + 'ms')
})
})
bot.init('_token_') //logging in with the token
bot.on('fisherCode', function (router, code, err) { //displaying the fishercodes trigerred
router.response.send('fisherCode ' + code + '\nError message: ' + err.message)
})
Documentation
Middleware list
The middleware list is available here