Skip to content

Instantly share code, notes, and snippets.

@MichaelBarney
Created May 1, 2020 21:12
Show Gist options
  • Save MichaelBarney/207c3378cda8f7376bdf32d985e9a12e to your computer and use it in GitHub Desktop.
Save MichaelBarney/207c3378cda8f7376bdf32d985e9a12e to your computer and use it in GitHub Desktop.
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