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/default.js

33 lines
862 B
JavaScript

const huh = require('huh')
const fbTemplate = require('claudia-bot-builder/lib/facebook/format-message')
const {send} = require('./common')
const uncapitalize = str => str.charAt(0).toLowerCase() + str.slice(1)
const run = (msg, recipient) => {
send(recipient.id, [
new fbTemplate.ChatAction('mark_seen').get(),
new fbTemplate.ChatAction('typing_on').get(),
new fbTemplate.Text(
`Sorry, ${
recipient.first_name
}. I didn't understand that, probably because of ${uncapitalize(
huh.get()
)}`
).get(),
new fbTemplate.ChatAction('typing_on').get(),
new fbTemplate.Pause(1000).get(),
new fbTemplate.Text(
`I'll improve in time, don't worry. Meanwhile, you can type 'start' to start the show over.`
).get(),
])
}
module.exports = [
{
id: 'default',
keywords: [],
run,
},
]