 
 (defn connect
   ([token functions]
-    (connect token functions default-log-events? default-log-function default-max-text-message-size))
+    (connect token functions default-log-events? default-log-function default-max-text-message-size false))
   ([token functions log-events?]
-    (connect token functions log-events? default-log-function default-max-text-message-size))
+    (connect token functions log-events? default-log-function default-max-text-message-size false))
   ([token functions log-events? max-text-message-size]
-    (connect token functions log-events? default-log-function max-text-message-size))
+    (connect token functions log-events? default-log-function max-text-message-size false))
   ([token functions log-events? log-function max-text-message-size]  
-    (disconnect)
+    (connect functions log-events? log-function max-text-message-size false))
+  ([token functions log-events? log-function max-text-message-size reconnecting?]
+    (if reconnecting? (do 
+                        (disconnect)
+                        (Thread/sleep 5000)))
     (reset! the-keepalive true)
     (reset! the-token (str "Bot " token))
     (reset! the-gateway (str

                                                                       "$referrer" ""
                                                                       "$referring_domain" ""}
                                                         "compress" false}}))
    (while (not @reconnect-needed) (Thread/sleep 1000))
    (try
      (connect token functions log-events? log-function max-text-message-size)
      (catch java.net.UnknownHostException e 
        (do
          (log-function "Caught exception: " (.getMessage e))
          (Thread/sleep 10000)
          (connect token functions log-events? log-function max-text-message-size))))))

(defn post-message [channel-id message]
  (http/post (str "https://discordapp.com/api/channels/" channel-id "/messages")

                               (if (not (nil? type)) (doseq [afunction (get functions type (get functions "ALL_OTHER" []))]
                                                       (afunction type data)))))))
    (.start (Thread. (fn []
                       (while @the-keepalive
                         (try
                           (if (nil? @the-heartbeat-interval)
                             (Thread/sleep 100)
                             (do
