botkit-chronos

1.1.0 • Public • Published

botkit-chronos NPM version Dependency Status

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

Readme

Keywords

Package Sidebar

Install

npm i botkit-chronos

Weekly Downloads

3

Version

1.1.0

License

MIT

Last publish

Collaborators

  • alexpsi