botkit icon indicating copy to clipboard operation
botkit copied to clipboard

.hears() function weird problem with a generated array (facebook-related)

Open morsidi opened this issue 10 years ago • 2 comments

Hi, I am using an api controller to get keywords from an certain API and trying to place the result array in the ".hears" function. For some reason it doesn't work. "keywords" is getting the right array for sure (checked that). Does someone has any idea? Thanks in advance.

api.getKeywords(function(keywords) {
controller.hears(keywords,'message_received', function (bot, message) {
...
}
});

morsidi avatar Aug 03 '16 07:08 morsidi

Hi, I have made a separate file for keywords. module.exports = { name: [ 'identify yourself', 'who are you', 'name', 'bot' ], greet: [ 'hi', 'hello', 'hey', 'yo' ] } This is my bot.js where I have my controller. controller.hears(keyword.name, 'message_received', function(bot, message) { bot.reply(message, ':|] I am a bot for Zyloon.'); })

Tell me if this helps you

webtaculars avatar Aug 08 '16 14:08 webtaculars

Did this help? Closing for now, feel free to reopen!

peterswimm avatar Oct 10 '16 16:10 peterswimm