1
0
This repository has been archived on 2018-04-23. You can view files and clone it, but cannot push or open issues or pull requests.
Files
vodopija-bot/bot/facebook/intents/index.js

21 lines
430 B
JavaScript

const normalize = str => str.toLowerCase()
const intents = {
default: require('./default'),
start: require('./start'),
drink: require('./drink'),
debug: require('./debug'),
}
const get = msg => {
const text = normalize(msg.text)
const intent = Object.keys(intents).find(
k => intents[k].keywords.indexOf(text) !== -1
)
return intent ? intents[intent].run : intents.default.run
}
module.exports = {
get,
}