 # Description:
-#   Get notifications from trello
+#   Get notifications from trello for a given board.
 #
 # Dependencies:
 #   "node-trello": "0.1.2"


check_interval_ms = process.env.HUBOT_TRELLO_INTERVAL ? 1000 * 60 * 5
checker = undefined
trello_key = process.env.HUBOT_TRELLO_KEY
trello_token = process.env.HUBOT_TRELLO_TOKEN
trello_board_id = process.env.HUBOT_TRELLO_BOARD_ID
trello_notify_room = process.env.HUBOT_TRELLO_NOTIFY_ROOM

last_notif_id = undefined

filter_actions =
  changeCard: (notif) ->
    if 'listAfter' not of notif.data

    get_notifs options, (notifs) ->
      console.info "#{notifs.length} new notifications received"
      for notif in notifs
        robot.messageRoom(config.notify_room, notif)
    , (err) ->
      msg.send "Error: #{err}"
  , check_interval_ms
