1
1
(ns sexpbot.plugins.utils
2
- (:use (sexpbot commands respond)))
2
+ (:use (sexpbot utilities commands respond)
3
+ (clj-time core format)))
3
4
4
5
(def known-prefixes
5
6
[\& \+ \@ \% \! \~])
9
10
(apply str (rest x))
10
11
x)) users))
11
12
13
+ (defn pangram? [s]
14
+ (let [letters (into #{} " abcdefghijklmnopqrstuvwxyz" )
15
+ text (->> s .toLowerCase (filter letters) (into #{}))]
16
+ (= text letters)))
17
+
12
18
(def util-cmds
13
- {" time" :time
14
- " rape" :rape
15
- " coin" :coin
16
- " help" :help
17
- " what" :what })
19
+ {" time" :time
20
+ " rape" :rape
21
+ " coin" :coin
22
+ " help" :help
23
+ " what" :what
24
+ " pangram?" :pangram })
18
25
19
26
(defmethod respond :time [{:keys [bot sender channel]}]
20
- (let [time (.toString ( java.util.Date. ))]
27
+ (let [time (unparse ( formatters :date-time-no-ms ) ( now ))]
21
28
(.sendMessage bot channel (str sender " : The time is now " time))))
22
29
23
30
(defmethod respond :rape [{:keys [args bot channel]}]
24
31
(let [user-to-rape (if (= (first args) " *" )
25
- (apply str (interpose
26
- " "
27
- (drop-modes (map #(.toString %) (.getUsers bot channel)))))
32
+ (->> (map #(.toString %) (.getUsers bot channel)) drop-modes stringify)
28
33
(first args))]
29
34
(.sendAction bot channel (str " raepz " user-to-rape " ." ))))
30
35
31
36
(defmethod respond :coin [{:keys [bot sender channel]}]
32
37
(.sendMessage bot channel (str sender " : " (if (= 0 (rand-int 2 )) " Heads." " Tails." ))))
33
38
34
39
(defmethod respond :help [{:keys [bot sender channel]}]
35
- (.sendMessage bot channel (str sender " : Help yourself, perverted fuck ." )))
40
+ (.sendMessage bot channel (str sender " : I can't help you, I'm afraid. You can only help yourself ." )))
36
41
37
42
(defmethod respond :what [{:keys [bot channel]}]
38
43
(.sendMessage bot channel " It's AWWWW RIGHT!" ))
39
44
45
+ (defmethod respond :pangram [{:keys [bot channel args]}]
46
+ (.sendMessage bot channel (-> args stringify pangram? str)))
47
+
40
48
41
49
(defmodule util-cmds :utils )
0 commit comments