Permalink
Browse files

If no message is given, just ping the user.

  • Loading branch information...
1 parent 673f78a commit d32c2eae94ebd07b457217f01267788d885d2df7 @Raynes committed Oct 4, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/lazybot/plugins/timer.clj
@@ -26,19 +26,19 @@
(assoc x count {:task (task count spec com-m)
:message (:message spec)})))))
-(defn parse-message [s]
+(defn parse-message [s nick]
(let [[offset message] (s/split s #" " 2)]
(-> (zipmap [:hour :minute :second]
(map #(Long. %) (s/split offset #":")))
- (assoc :message message))))
+ (assoc :message (or message nick)))))
(defplugin
(:cmd
"Creates a timer. Specify the time as the first argument in h:m:s format."
#{"timer"}
- (fn [{:keys [args] :as com-m}]
+ (fn [{:keys [args nick] :as com-m}]
(-> (s/join " " args)
- (parse-message)
+ (parse-message nick)
(set-timer com-m))
(send-message com-m "Timer added.")))
(:cmd

0 comments on commit d32c2ea

Please sign in to comment.