From 5e3b91929dede6381dca6a652ab1eb94a85d59c0 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 26 Feb 2012 14:15:26 +0100 Subject: Updated for the latest acidstate api. --- Hsbot/Plugin/Duck.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Hsbot/Plugin/Duck.hs') diff --git a/Hsbot/Plugin/Duck.hs b/Hsbot/Plugin/Duck.hs index c630c6a..c0da0c6 100644 --- a/Hsbot/Plugin/Duck.hs +++ b/Hsbot/Plugin/Duck.hs @@ -62,7 +62,7 @@ data DuckArgs = DuckArgs theDuck :: DuckArgs -> Plugin (Env IO) () theDuck (DuckArgs channel seconds) = do baseDir <- liftIO $ System.Environment.XDG.BaseDir.getUserDataDir "hsbot" - statDB <- liftIO $ openAcidStateFrom (baseDir ++ "/duckDB/") emptyStatDB + statDB <- liftIO $ openLocalStateFrom (baseDir ++ "/duckDB/") emptyStatDB ducksMVar <- liftIO newEmptyMVar timeMVar <- liftIO $ newMVar seconds duckSpawner channel seconds ducksMVar @@ -81,7 +81,7 @@ theDuck (DuckArgs channel seconds) = do empty <- liftIO $ isEmptyMVar ducksMVar ducksWaitingForDeath <- if empty then return 0 else liftIO $ modifyMVar ducksMVar (\x -> return (x - shots, x)) - _ <- update' statDB . UpdateScore (getSender msg) $ computeScore ducksWaitingForDeath shots + _ <- liftIO . update statDB . UpdateScore (getSender msg) $ computeScore ducksWaitingForDeath shots when ((ducksWaitingForDeath > 0) && (shots >= ducksWaitingForDeath)) $ do _ <- liftIO $ takeMVar ducksMVar time <- liftIO $ readMVar timeMVar @@ -95,7 +95,7 @@ theDuck (DuckArgs channel seconds) = do _ -> answerMsg msg "Invalid time value." "duck":"freq":_ -> answerMsg msg $ "You must provide an amount of seconds the bot should wait before spawning " ++ "new ducks after the end of a round." - "duck":"stat":_ -> query' statDB GetDuckStats >>= printDuckStats channel + "duck":"stat":_ -> liftIO (query statDB GetDuckStats) >>= printDuckStats channel "duck":_ -> answerMsg msg "Invalid duck command." _ -> return () | otherwise = return () -- cgit v1.2.3