Improve chat flow with answers
This commit is contained in:
@@ -1,14 +1,64 @@
|
||||
const fbTemplate = require('claudia-bot-builder/lib/facebook/format-message')
|
||||
const {send} = require('./common')
|
||||
const {send, noop} = require('./common')
|
||||
|
||||
const INTENT_START_START = 'intent_start_start'
|
||||
const INTENT_START_ABOUT = 'intent_start_about'
|
||||
const INTENT_START_CHANGE_ALERTS = 'intent_change_alert'
|
||||
|
||||
const run = (msg, recipient) => {
|
||||
const reply = new fbTemplate.Text(`
|
||||
send(recipient.id, [
|
||||
new fbTemplate.ChatAction('mark_seen').get(),
|
||||
new fbTemplate.ChatAction('typing_on').get(),
|
||||
new fbTemplate.Pause(500).get(),
|
||||
new fbTemplate.Text(`
|
||||
This is your menu. You can reach it by writing Menu, or Help, or Start
|
||||
`).get()
|
||||
send(recipient.id, reply)
|
||||
`)
|
||||
.addQuickReply('About vodopija-bot', INTENT_START_ABOUT)
|
||||
.addQuickReply('Change alerts', INTENT_START_CHANGE_ALERTS)
|
||||
.get(),
|
||||
])
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
keywords: ['start', 'menu', 'help'],
|
||||
run,
|
||||
const runAbout = (msg, recipient) => {
|
||||
send(recipient.id, [
|
||||
new fbTemplate.ChatAction('mark_seen').get(),
|
||||
new fbTemplate.ChatAction('typing_on').get(),
|
||||
new fbTemplate.Text(`Thanks for asking 🙂`).get(),
|
||||
new fbTemplate.ChatAction('typing_on').get(),
|
||||
new fbTemplate.Pause(500).get(),
|
||||
new fbTemplate.Text(
|
||||
`vodolija-bot was created by Marko Marković as a test for SPARTANS AI LTD.`
|
||||
).get(),
|
||||
new fbTemplate.ChatAction('typing_on').get(),
|
||||
new fbTemplate.Pause(1000).get(),
|
||||
new fbTemplate.Text(
|
||||
`Its goal is to help you drink more water for a healthier life.`
|
||||
).get(),
|
||||
new fbTemplate.ChatAction('typing_on').get(),
|
||||
new fbTemplate.Pause(1000).get(),
|
||||
new fbTemplate.Text(`
|
||||
It features:
|
||||
☑ Daily water reminders
|
||||
☑ Personalized AI recommendations
|
||||
☑ Number of cups of water drank this week
|
||||
☑ Tips about water drinking
|
||||
`)
|
||||
.addQuickReply('Back', INTENT_START_START)
|
||||
.get(),
|
||||
])
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
keywords: [INTENT_START_START, 'start', 'menu', 'help'],
|
||||
run,
|
||||
},
|
||||
{
|
||||
keywords: [INTENT_START_ABOUT],
|
||||
run: runAbout,
|
||||
},
|
||||
{
|
||||
keywords: [INTENT_START_CHANGE_ALERTS],
|
||||
run: noop,
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user