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