check for string message

Former-commit-id: 0187bc7bce
This commit is contained in:
Roman Volosovskyi 2016-04-25 11:36:37 +03:00
parent ef3668044b
commit 87465e7599
1 changed files with 3 additions and 2 deletions

View File

@ -58,8 +58,9 @@
(defn load-commands []
(http-get "chat-commands.js" execute-commands-js nil))
(defn check-suggestion [db text]
(when-let [suggestion-text (re-matches #"^![^\s]+\s" text)]
(defn check-suggestion [db message]
(when-let [suggestion-text (when (string? message)
(re-matches #"^![^\s]+\s" message))]
(let [suggestion-text' (s/trim suggestion-text)
[suggestion] (filter #(= suggestion-text' (:text %))
(get-commands db))]