Created
November 14, 2012 16:53
-
-
Save nathanic/4073283 to your computer and use it in GitHub Desktop.
closer match to the style of silly_big_ben_irc_bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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