forked from LibreGaming/matchbot
Refactor response functions to use 'as->' macro
Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
This commit is contained in:
parent
e4df11f12d
commit
d9dc7acd34
28
src/bot.clj
28
src/bot.clj
|
@ -13,25 +13,19 @@
|
||||||
(defn sort-case-insensitive [coll]
|
(defn sort-case-insensitive [coll]
|
||||||
(sort #(apply compare (map str/lower-case %&)) coll))
|
(sort #(apply compare (map str/lower-case %&)) coll))
|
||||||
|
|
||||||
(defn sorted-players-of-game [state game]
|
(defn match-string [& {:keys [state game player]}]
|
||||||
(->> game
|
(as-> (keywordise-game game) x
|
||||||
(keywordise-game)
|
(game/get-players-of-game state x)
|
||||||
(game/get-players-of-game state)
|
(sort-case-insensitive x)
|
||||||
(sort-case-insensitive)))
|
(str/join " " x)
|
||||||
|
(str "Anyone ready for " game "? " x)))
|
||||||
(defn match-string [& {:keys [state game]}]
|
|
||||||
(str "Anyone ready for "
|
|
||||||
game
|
|
||||||
"? "
|
|
||||||
(str/join " " (sorted-players-of-game state game))))
|
|
||||||
|
|
||||||
(defn list-players-string [& {:keys [state game]}]
|
(defn list-players-string [& {:keys [state game]}]
|
||||||
(let [players (str/join (map #(str " _" % "_")
|
(as-> (keywordise-game game) x
|
||||||
(sorted-players-of-game state game)))]
|
(game/get-players-of-game state x)
|
||||||
(str "Players of "
|
(sort-case-insensitive x)
|
||||||
game
|
(map #(str " _" % "_") x)
|
||||||
":"
|
(apply str "Players of " game ":" x)))
|
||||||
players)))
|
|
||||||
|
|
||||||
(defn add-player-string [& {:keys [game player]}]
|
(defn add-player-string [& {:keys [game player]}]
|
||||||
(str "Added "
|
(str "Added "
|
||||||
|
|
Loading…
Reference in New Issue