Skip to content

Instantly share code, notes, and snippets.

@nathanic
Created November 14, 2012 16:53
Show Gist options
  • Save nathanic/4073283 to your computer and use it in GitHub Desktop.
Save nathanic/4073283 to your computer and use it in GitHub Desktop.
closer match to the style of silly_big_ben_irc_bot
(ns simplebot.core
(:use [clj-time.core :exclude [extend]]
[clj-time.local])
(:require [irclj.core :as ircb]
[overtone.at-at :as at-at]
[clojure.string :as string]))
(def CHANNEL "#silly-bot-test")
(defn -main [& args]
(let [irc (ircb/connect "irc.freenode.net" 6667 "clj-big-ben")
t (local-now)
minutes-left (- 59 (minute t))
seconds-left (- 60 (sec t))
delay (* 1000 (+ (* 60 minutes-left) seconds-left))]
(ircb/join irc CHANNEL)
(at-at/every (* 60 60 1000)
(fn []
(let [h (hour (local-now))
h (if (zero? h) 12 h)]
(ircb/message irc CHANNEL
(string/join " " (repeat h "*BONG*"))))
(at-at/mk-pool)
:initial-delay delay))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment