Permalink
Browse files

Support spaces instead of colons in timers.

  • Loading branch information...
Raynes committed Feb 27, 2014
1 parent 7436290 commit 04fd054199a3f9c862714b1e0430bb1c9cb57912
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/lazybot/plugins/timer.clj
@@ -27,10 +27,11 @@
:message (:message spec)})))))
(defn parse-message [s nick]
- (let [[offset message] (s/split s #" " 2)]
+ (let [split-re #"(\d+)[: ](\d+)[: ](\d+)(?: (.+))?"
+ [_ hour minute second msg] (re-find split-re s)]
(-> (zipmap [:hour :minute :second]
- (map #(Long. %) (s/split offset #":")))
- (assoc :message (or message nick)))))
+ (map #(Long. %) [hour minute second]))
+ (assoc :message (or msg nick)))))
(defplugin
(:cmd

0 comments on commit 04fd054

Please sign in to comment.