'use strict';

var Bot = require('slackbots');
var token = process.env.BOT_API_KEY || require('../token');

var settings = {
  token,
  name: 'munchbot'
}

var LunchBot = new Bot(settings);

LunchBot.on('start', function() {
  this.postMessageToChannel('hackday-lunchbot', 'MEOW MEOW!');
});

@@ -99,16 +99,57 @@
 token');
+%0Avar phrases = %5B%0A  'What is for lunch'%0A%5D;
 %0A%0Avar se
@@ -190,16 +190,128 @@
 bot'%0A%7D%0A%0A
+var restaurants = %5B%0A  %7B%0A    name: 'Bermuda Br%C3%A4u',%0A    menu: ''%0A  %7D,%0A  %7B%0A    name: 'Enwok',%0A    menu: ''%0A  %7D%0A%5D;%0A%0A
 var Lunc
@@ -337,16 +337,19 @@
 ings);%0A%0A
+// 
 LunchBot
@@ -374,16 +374,19 @@
 ion() %7B%0A
+// 
   this.p
@@ -444,8 +444,539 @@
 ');%0A
+// 
 %7D);%0A
+%0ALunchBot.on('message', function(data) %7B%0A  var message = data.text %7C%7C '';%0A  var listOfRestaurants = getListOfRestaurants();%0A%0A  if (isValidMessage(message)) %7B%0A%0A    this.postMessageToChannel('hackday-lunchbot', 'Which restaurant would you like visit?' + listOfRestaurants);%0A  %7D%0A%7D);%0A%0Afunction getListOfRestaurants () %7B%0A  var list = '%5Cn';%0A%0A  for (var i in restaurants) %7B%0A    list += '- ' + restaurants%5Bi%5D.name + '%5Cn';%0A  %7D%0A%0A  return list;%0A%7D%0A%0Afunction isValidMessage(message) %7B%0A  return message.indexOf('What is for lunch') !== -1;%0A%7D%0A

Add basic response