Skip to content

Commit

Permalink
Support spaces instead of colons in timers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raynes committed Feb 27, 2014
1 parent 7436290 commit 04fd054
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lazybot/plugins/timer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 04fd054

Please sign in to comment.