 # Dependencies:
 #   'feedparser': '*'
 #   'request': '*'
+#   'underscore': '*'
 #
 # Configuration:
 #   FEED_CHECK_INTERVAL


  robot.respond /check_feed (h[^ ]+)/i, (msg) ->
    url = msg.match[1]
    robot.brain.data.feed_check[url] = []
    msg.reply 'Subscribing to ' + url

  robot.respond /check_feed stop ([^ ]+)/i, (msg) ->
    url = msg.match[1]
    if robot.brain.data.feed_check[url]?
      msg.reply 'Unsubscribing from ' + url
      delete robot.brain.data.feed_check[url]
    else
      msg.reply url + ' isn`t subscribed'

  robot.respond /checking_feed/i, (msg) ->
    keys = Object.keys robot.brain.data.feed_check
    if keys.length == 0
      msg.reply 'No feed subscribed'
    else
      msg.reply 'Subscribed: ' + keys.join(' , ')


FeedParser = require 'feedparser'
request = require 'request'
_ = require 'underscore'

module.exports = (robot) ->
  feed_check_interval = null
