 (ns clj-mrazik.irc-bot)
 
 (require '[irclj.core :as irc])
+(require '[clj-calendar.calendar :as calendar])
 
-(def connection
-    (atom nil))
-
-(def bot-nick
-    (atom nil))
+(require '[clj-mrazik.dyncfg   :as dyncfg])
+(require '[clj-mrazik.schedule :as schedule])
 
 (defn message-to-channel?
     [message]

        (let [conn (irc/connect server port nick
                                :callbacks {:privmsg on-incoming-message})]
            (println "Connected, joining to channel" channel)
            (reset! connection conn)
            (reset! bot-nick nick)
            (irc/join @connection channel)
            (println "Connected..."))))


           command :command} incoming-message]
           (println "Received message from" nick "to" target ":" text "(" host command ")")
           (println incoming-message)
           (if (message-for-me? @dyncfg/bot-nick incoming-message)
               (irc/reply connection (create-reply incoming-message)
                                     (prepare-reply-text incoming-message nick text)))))

(defn send-message
    [recipients target message-text]
    (let [message {:target target :command "PRIVMSG"}]
        (irc/reply @dyncfg/connection message (str recipients " " message-text))))

(defn start-irc-bot
    [configuration]
