Skip to content

Commit

Permalink
Added a tell command to the whatis plugin.
Browse files Browse the repository at this point in the history
"$tell G0SUB about clojure" will PM G0SUB the response if the subject
exists in the database.
  • Loading branch information
ghoseb committed Dec 11, 2010
1 parent ca81a29 commit b94c36c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/sexpbot/plugins/whatis.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit b94c36c

Please sign in to comment.