Closed lorenries closed 8 years ago
Nice work!
The issue on the sending me a crossword is that the messageRoom
method is actually on the bot object rather than the message object. You would want line 25 to be return bot.messageRoom( 'johnmaster' , message.random(crosswords)) ;
With adding the crossword, you are right now accessing the brain storage on the bot (some object with special methods for setting and getting) and asking what value it has associated with the key 'newCrossword'. It will return undefined because nothing has been set to that key. You then push the undefined value to the array. What you'll want to do is access msg.match to get the input and then push that value to the array (or to the brain with set
)
The javascript: https://github.com/lorenries/GAslackbot/blob/master/scripts/bot.js
The bot is supposed to do 4 things, 2 of which it does successfully.
It does not, unfortunately, send John a random crossword if you ask it to, nor does it add a crossword to the array of random crosswords. :( still trying to figure those out.