Skip to content
Browse files

Added a tell command to the whatis plugin.

"$tell G0SUB about clojure" will PM G0SUB the response if the subject
exists in the database.
  • Loading branch information...
1 parent ca81a29 commit b94c36c52271766c07de9f6bfb7c4d2a429ba498 @ghoseb ghoseb committed Dec 11, 2010
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/sexpbot/plugins/whatis.clj
View
10 src/sexpbot/plugins/whatis.clj
@@ -22,6 +22,16 @@
(if-let [result (fetch-one :whatis :where {:subject (first args)})]
(send-message com-m (str (first args) " = " (:is result)))
(send-message com-m (str (first args) " does not exist in my database.")))))
+
+ (:cmd
+ "Pass it a key, and it will tell the recipient what is at the key in the database via PM
+Example - $tell G0SUB about clojure"
+ #{"tell"}
+ (fn [{:keys [bot channel args] :as com-m}]
+ (when-let [subject (nth args 2 nil)]
+ (if-let [result (fetch-one :whatis :where {:subject subject})]
+ (send-message (assoc com-m :channel (first args)) (str subject " = " (:is result)))
+ (send-message com-m (str subject " does not exist in my database."))))))
(:cmd
"Forgets the value of a key."

0 comments on commit b94c36c

Please sign in to comment.
Something went wrong with that request. Please try again.