From 2f27cb8a8622d0cb812be4140dfac16fab646fe3 Mon Sep 17 00:00:00 2001 From: Sebastian Crane Date: Sat, 26 Feb 2022 23:23:35 +0000 Subject: [PATCH] Omit sender of !match command from players list Signed-off-by: Sebastian Crane --- src/bot.clj | 3 ++- test/bot_test.clj | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bot.clj b/src/bot.clj index 59ce976..477d78a 100644 --- a/src/bot.clj +++ b/src/bot.clj @@ -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) diff --git a/test/bot_test.clj b/test/bot_test.clj index e0845bb..9081722 100644 --- a/test/bot_test.clj +++ b/test/bot_test.clj @@ -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_"