1
0

Improve chat flow with answers

This commit is contained in:
2018-04-23 17:28:42 +02:00
parent b3bc949e01
commit 49b91c0a36
10 changed files with 226 additions and 54 deletions

View File

@@ -1,16 +1,32 @@
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) => {
const reply = new fbTemplate.Text(
`Sorry, ${
recipient.first_name
}. I am a young Bot and still learning. Type "Start" to show the start over.`
).get()
send(recipient.id, reply)
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 = {
keywords: [],
run,
}
module.exports = [
{
id: 'default',
keywords: [],
run,
},
]