Omit sender of !match command from players list

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
This commit is contained in:
Sebastian Crane 2022-02-26 23:23:35 +00:00
parent d9dc7acd34
commit 2f27cb8a86
2 changed files with 4 additions and 3 deletions

View File

@ -16,6 +16,7 @@
(defn match-string [& {:keys [state game player]}]
(as-> (keywordise-game game) x
(game/get-players-of-game state x)
(disj x player)
(sort-case-insensitive x)
(str/join " " x)
(str "Anyone ready for " game "? " x)))
@ -63,7 +64,7 @@
(if game
(condp = command
"!match"
(match-string :state @state :game game)
(match-string :state @state :game game :player sender)
"!add"
(do (swap! state game/add-player-of-game game-keyword sender)

View File

@ -18,8 +18,8 @@
(sort-case-insensitive ["C" "A" "b"]))))
(deftest match-string-test
(is (= '"Anyone ready for quasi-Rts? 123 abc"
(match-string :state test-state :game "quasi-Rts"))))
(is (= '"Anyone ready for quasi-Rts? abc"
(match-string :state test-state :game "quasi-Rts" :player "123"))))
(deftest list-players-string-test
(is (= "Players of HYPOTHETICAL-shooter: _123_ _abc_ _xyz_"