From ac9aa309340f83e9cd638a0efbb2c2b4e78a4149 Mon Sep 17 00:00:00 2001 From: Bernardo Gomes Negri <38192358+BernardoGomesNegri@users.noreply.github.com> Date: Tue, 2 Nov 2021 11:38:18 -0300 Subject: [PATCH] can now report on bots --- app/Main.hs | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 20e1031..902aaef 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -170,20 +170,26 @@ parsePlayer = do name <- between (char '\"') (char '\"') (many1 $ noneOf "\"") white steamid <- parseUntilX ' ' anyChar - white - minutes <- anyNumSep ':' :: Parsec String () Int - seconds <- anyNum - white - let time = (minutes * 60) + seconds - ping <- anyNum - white - loss <- anyNum - white - connState <- parseUntilX ' ' anyChar - white - adr <- parseUntilEof - return $ Player {name = name, steamid = steamid, ping = ping, loss = loss, connectionStatus = connState, - playerAdress = adr, time = time, userid = numId} + if steamid /= "BOT" then do + white + minutes <- anyNumSep ':' :: Parsec String () Int + seconds <- anyNum + white + let time = (minutes * 60) + seconds + ping <- anyNum + white + loss <- anyNum + white + connState <- parseUntilX ' ' anyChar + white + adr <- parseUntilEof + return $ Player {name = name, steamid = steamid, ping = ping, loss = loss, connectionStatus = connState, + playerAdress = adr, time = time, userid = numId} + else do + white + state <- parseUntilEof + return $ Player {name = name, steamid = "BOT", ping = 0, loss = 0, connectionStatus = state, playerAdress = "localhost", time = 0, + userid = numId} withToken :: (Token -> Connection -> ActionT Text WebM ()) -> ActionT Text WebM () withToken f = do