Invalid format for .say() message
mohammadameer opened this issue · comments
Mohamed Ameir Abdalla Taha commented
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.
`
Mohamed Ameir Abdalla Taha commented
the problem was that i have not make the random function work i just need to add ()