 
 filter_actions =
   changeCard: (notif) ->
-    if 'listAfter' of notif.data
-      "#{notif.memberCreator.username} moved card `#{notif.data.card.name}` from `#{notif.data.listBefore.name}` to `#{notif.data.listAfter.name}`" + cardUrl(notif.data.card)
+    if 'listAfter' not of notif.data
+      return
+    "#{notif.memberCreator.username} moved card `#{notif.data.card.name}` from `#{notif.data.listBefore.name}` to `#{notif.data.listAfter.name}` - #{cardUrl(notif.data.card)}"
   commentCard: (notif) ->
-    "#{notif.memberCreator.username} commented on card `#{notif.data.card.name}`: #{notif.data.text}" + cardUrl(notif.data.card)
+    "#{notif.memberCreator.username} commented on card `#{notif.data.card.name}`: #{notif.data.text} - #{cardUrl(notif.data.card)}"
   createdCard: (notif) ->
-    "#{notif.memberCreator.username} created card `#{notif.data.card.name}`" + cardUrl(notif.data.card)
+    "#{notif.memberCreator.username} created card `#{notif.data.card.name}` - #{cardUrl(notif.data.card)}"
 
 cardUrl = (card) ->
-  " - https://trello.com/card/#{trello_board_id}/#{card.idShort}"
+  "https://trello.com/card/#{trello_board_id}/#{card.idShort}"
 
 connect = (onConnected, onError) ->
   console.error "missing HUBOT_TRELLO_KEY" if not trello_key


get_notifs = (options, onComplete, onError) ->
  connect (t) ->
    t.get "/1/members/me/notifications", options, (err, data) ->
      if data.length
        last_notif_id = data[0].id
      notifs = (filter_actions[notif.type](notif) for notif in data)
      onComplete(notifs)
  , onError

module.exports = (robot) ->
  robot.respond /trello ping/i, (msg) ->

      limit: 10
      since: last_notif_id
    get_notifs options, (notifs) ->
      for notif in notifs
        msg.send(notif)
    , (err) ->
      msg.send "Error: #{err}"

  init_checker(robot)
