Charca / bootbot

Facebook Messenger Bot Framework for Node.js
MIT License
970 stars 252 forks source link

Invalid format for .say() message #175

Closed mohammadameer closed 5 years ago

mohammadameer commented 5 years ago

i have a list of responses to request

let res = [ "how are you", "wow", ]

for every request there will be a response i have make a prototype in the array object to get random from the array


Array.prototype.random = function () {
    return this[Math.floor(Math.random() * this.length)]
}

bot.hear(words.hello.req, (payload, chat) => {

    let res = words.hello.res.random

    chat.say(res)

})

i upload my code to heroku and i get this

` Invalid format for .say() message.

`

mohammadameer commented 5 years ago

the problem was that i have not make the random function work i just need to add ()