Browse files

Handle multiple issues in one message.

  • Loading branch information...
1 parent de4a0ef commit 8347c8d7e814d790e481cc9f8b28d7ee81130872 @Raynes Raynes committed Aug 28, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/lazybot/plugins/github.clj
View
9 src/lazybot/plugins/github.clj
@@ -84,7 +84,10 @@ specified in config.clj."
"These boots are made for walkin' and that's just what they'll do. "
"One of these days these boots are gonna walk all over you."))
-(def issue-regex #"[\w-]+\/[\w-]+#\d+")
+(defn extract-issues
+ "Extract issues out of a message."
+ [message]
+ (re-seq #"[\w-]+\/[\w-]+#\d+" message))
(defn parse-issue
"Parse an issue message into its user, repo, and issue number parts."
@@ -111,6 +114,6 @@ specified in config.clj."
:on-message
(fn [{:keys [message nick bot com] :as com-m}]
(when-not ((get-in @bot [:config (:server @com) :user-blacklist]) nick)
- (when-let [match (re-find issue-regex message)]
- (when-let [message (issue-message (parse-issue match))]
+ (doseq [issue (extract-issues message)]
+ (when-let [message (issue-message (parse-issue issue))]
(send-message com-m message)))))))

0 comments on commit 8347c8d

Please sign in to comment.