 (ns org.teamweek.slackbot
   (:require [clojure.core.async :as async]
+            [clojure.string :as str]
             [datomic.api :as d]
             [aleph.http :as http]
             [manifold.stream :as stream]

                             [$db-after  ?team :team/schedule ?schedule-after]
                             [(not= ?schedule-before ?schedule-after)]]
                           db-before db-after)]
    (prn "Updated crons:" updated-crons)))

(defn listen-for-team-updates [scheduler db-conn]
  (let [queue (d/tx-report-queue db-conn)]

      (let [{:keys [db-before
                    db-after
                    tx-data]} (.take queue)]
        (schedule-new scheduler db-conn db-before db-after)
        (schedule-removed scheduler db-conn db-before db-after)
        (schedule-updates scheduler db-conn db-before db-after)))))

(defn -main [db-uri]
  (log/merge-config! {:level :info
