Improve chat flow with answers
This commit is contained in:
@@ -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,
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user