botkit-chronos
v1.1.0
Published
A middleware that extracts time information from messages using the chrono library.
Downloads
1
Readme
botkit-chronos
A middleware that extracts time information from messages using the chrono library. (WORK IN PROGRESS)
Installation
$ npm install --save botkit-chronos
Usage
var Botkit = require('botkit');
var botkitChronos = require('botkit-chronos');
var controller = Botkit.slackbot({
debug: false
});
botkitChronos.use(controller);
// The controller will listen on all texts starting with 'meeting on' and are followed by a phrase that contains time related
// content. For example the robot will respond to:
//
// Meeting on Friday
// Meeting in a month
// Meeting next monday
// Meeting on the 6th of June
//
// When a time phrase is detected its replaced with TS#timestamp
controller.hears(['meeting on TS(.*)'],'direct_message,direct_mention,mention', function(bot, message) {
console.log(new Date(message.text.match(/meeting on TS(.*)/i)[0]));
});
License
MIT © Alex Psi