0.17.13 • Published 6 years ago
prague-fluent v0.17.13
Prague recipe for a fluent API. Usually a building block for something like prague-botbuilder).
To install
npm install -S prague-fluent
To use
import { Helpers } from 'prague-fluent';
const { tryInOrder, ifMatches, ifTrue, ifMessage, ifText, ifRegExp } = new Helpers<YOUR_ROUTABLE_FORMAT>();
const router =
ifMessage()
.thenTry(
tryInOrder(
ifRegExp(/howdy|hi|hello/i).thenDo(c => c.reply(`Hello to you!`)),
ifRegExp(/what time is it/).thenDo(c => c.reply(`It's showtime.`)),
ifRegExp(/my name is (.*)/).thenDo((c, matches) => c.reply(`Nice to meet you, ${matches[1]}`))
)
.defaultDo(c => c.reply("I will never understand you humans"))
)
.elseDo(c => c.reply("non-message activity"))
let routable: YOUR_ROUTABLE_FORMAT = { /* set up object here */ }
router
.route(routable)
.then(routed => console.log("routed", routed));
0.17.13
6 years ago
0.17.12
6 years ago
0.17.11
6 years ago
0.17.10
6 years ago
0.17.9
6 years ago
0.17.8
6 years ago
0.17.7
6 years ago
0.17.6
6 years ago
0.17.5
6 years ago
0.17.4
6 years ago
0.17.3
6 years ago
0.17.2
6 years ago
0.17.1
6 years ago
0.17.0
6 years ago
0.16.5
6 years ago
0.16.4
6 years ago
0.16.3
6 years ago
0.16.2
6 years ago
0.16.1
6 years ago
0.16.0
6 years ago