// Description:
//   Youtube Feeds
//
// Dependencies:
//   None
//
// Configuration:
//   None
//
//// Commands:
//   hubot yf add <username>
//   hubot yf remove <username>
//   hubot yf list
//
// Author:
//   Eluinhost

module.exports = function(robot) {

    var notificationList = require('./lib/notification-list.js')(robot.brain);
    var videoFetcher = require('./lib/video-fetcher.js')(robot);


    robot.respond(/yf add(.*?)$/i, function(msg) {
        var name = msg.match[1];
        if(addNotification(new YoutubeNotification(name, msg.room))) {
            msg.reply('Added notifications for: ' + name);
        } else {
            msg.reply(name + ' is already set for notifications in this channel');
        }
    });

    robot.respond(/yf remove(.*?)$/i, function(msg) {
        var name = msg.match[1];
        if(removeNotification(new YoutubeNotification(name, msg.room))) {
            msg.reply('Removed notifications for: ' + name);
        } else {
            msg.reply(name + ' is not set for notifications in this channel');
        }
    });

    robot.respond(/yf list$/i, function(msg) {
        if(notifcations.length === 0) {
            msg.reply('No notifications set for this channel');
            return;
        }
        var userList = notifcations.map(function(element) {
            return element.user;
        }).join(', ');

        msg.reply('Notifications for: ' + userList);
    });
};
@@ -498,12 +498,9 @@
  if(
-addN
+n
 otif
@@ -502,36 +502,32 @@
 notification
-(new Youtube
+List.add
 Notification
@@ -518,32 +518,36 @@
 .addNotification
+sFor
 (name, msg.room)
@@ -539,33 +539,32 @@
 name, msg.room))
-)
  %7B%0A            m
@@ -830,15 +830,9 @@
  if(
-removeN
+n
 otif
@@ -842,19 +842,18 @@
 tion
-(new Youtub
+List.remov
 eNot
@@ -861,16 +861,20 @@
 fication
+sFor
 (name, m
@@ -882,17 +882,16 @@
 g.room))
-)
  %7B%0A     
@@ -1120,24 +1120,42 @@
     if(notif
+icationList.notifi
 cations.leng
@@ -1206,16 +1206,20 @@
 cations 
+are 
 set for 
@@ -1292,16 +1292,34 @@
  = notif
+icationList.notifi
 cations.
@@ -1373,16 +1373,20 @@
 ent.user
+name
 ;%0A      
@@ -1435,24 +1435,37 @@
 ications for
+ this channel
 : ' + userLi

use new methods for controlling notifications list