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,14 +1,20 @@
const flatten = require('flatten')
const fbTemplate = require('claudia-bot-builder/lib/facebook/format-message')
const {send} = require('./common')
const run = (msg, recipient) => {
const reply = new fbTemplate.Text(`
This is a \`Text\` message
`).get()
send(recipient.id, reply)
const INTENT_DEBUG_START = 'intent_debug_start'
const run = (msg, recipient, data) => {
const text = flatten(data)
.map(d => JSON.stringify(d, null, 2))
.join(', ')
send(recipient.id, new fbTemplate.Text(`DEBUG: \`${text}\``).get())
}
module.exports = {
keywords: ['debug'],
run,
}
module.exports = [
{
id: 'debug',
keywords: [INTENT_DEBUG_START, 'debug'],
run,
},
]