gameServer: Handle empty chat command (partially)
authorWuzzy <Wuzzy2@mail.ru>
Thu, 04 Oct 2018 14:54:57 +0200
changeset 13827 28a86816dc01
parent 13826 07b3dacd00f8
child 13828 76a1d6275cd3
gameServer: Handle empty chat command (partially)
gameServer/HWProtoCore.hs
--- a/gameServer/HWProtoCore.hs	Thu Oct 04 14:36:42 2018 +0200
+++ b/gameServer/HWProtoCore.hs	Thu Oct 04 14:54:57 2018 +0200
@@ -65,6 +65,10 @@
         else
         handleCmd_NotEntered cmd
 
+unknownCmdWarningText :: B.ByteString
+unknownCmdWarningText = loc "Unknown command or invalid parameters. Say '/help' in chat for a list of commands."
+
+handleCmd_loggedin ["CMD"] = return [Warning unknownCmdWarningText]
 
 handleCmd_loggedin ["CMD", parameters] = uncurry h $ extractParameters parameters
     where
@@ -111,7 +115,7 @@
                 [ModifyClient (\c -> c{hasSuperPower = True})
                 , AnswerClients [sendChan cl] ["CHAT", nickServer, loc "Super power activated."]
                 ]
-        h _ _ = return [Warning $ loc "Unknown command or invalid parameters. Say '/help' in chat for a list of commands." ]
+        h _ _ = return [Warning unknownCmdWarningText]
 
 
         extractParameters p = let (a, b) = B.break (== ' ') p in (upperCase a, B.dropWhile (== ' ') b)