Created
May 1, 2020 21:12
-
-
Save MichaelBarney/207c3378cda8f7376bdf32d985e9a12e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(controller) { | |
// Mensagens | |
controller.hears(['Oi', 'Olá!'],'message', async(bot, message) => { | |
await bot.reply(message, 'Olá!'); | |
}); | |
controller.hears(new RegExp(/^meu nome é (.*?)$/i), 'message', async(bot, message) => { | |
let param = message.matches[1]; | |
await bot.reply(message, `Bem-vindo ${ param }!`); | |
}); | |
// Postbacks | |
controller.on('facebook_postback', async(bot, message) => { | |
await bot.reply(message,`Escutei o seguinte postback: ${ message.text }`); | |
}); | |
controller.hears('get_started', 'facebook_postback', async(bot, message) => { | |
await bot.reply(message, `Vamos começar!`); | |
await bot.reply(message, `Qual é o seu nome?`); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment