Charca / bootbot

Facebook Messenger Bot Framework for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid format for .say() message

mohammadameer opened this issue · comments

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.

`

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