A modular slackbot
Ferd is a modular Slack Bot. It abstracts away the complexity of the Slack Real-Time Messaging API. Use this repo as an open source project to build your own bots, or check out FerdX for some fun.
To Run
Uses ES6. Runs using node --harmony
var ferdModule = require('ferdModule');
var Ferd = require('ferd');
var ferd = new Ferd();
ferd.addModule(ferdModule);
ferd.login();
ferd.logout();
Creating Ferd Modules
To create modules, use the following syntax:
var randomYo = ["whats up? ", "hey ", "yo "];
var getRandomYo = function() {
return randomYo[Math.floor(Math.random() * randomYo.length)];
};
module.exports = function(ferd) {
var yoCount = 0;
ferd.listen(/(.*) is (.*)/, function(response) {
var sender = response.getMessageSender();
response.send("No, " + sender.name + ", you " + "aren't " + response.match[2]);
});
var listener = ferd.respond(/yo/i, function(response) {
var sender = response.getMessageSender();
response.send(getRandomYo() + sender.name);
yoCount++;
});
ferd.ignore(listener);
ferd.session(/hello/, /goodbye/, function(response) {
response.send("I hear you... " + response.getMessageSender().name);
});
ferd.listen(/how many yo?/ function(response) {
response.send(yoCount);
});
};
Slack types
For more information on Slack types, check out https://api.slack.com/types.
Contributing
For contributing, see the contributing guidelines.
Style Guide
If you're contributing, make sure to check out the style guide.
Team
License
MIT