From b9a99ebcdcd913176569fdc7871a30daf9351265 Mon Sep 17 00:00:00 2001 From: rexim Date: Wed, 9 Oct 2019 07:42:46 +0700 Subject: [PATCH] Reduce !asciify cooldown to 1 minute --- src/Bot/Asciify.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Bot/Asciify.hs b/src/Bot/Asciify.hs index 912378a..3b516d1 100644 --- a/src/Bot/Asciify.hs +++ b/src/Bot/Asciify.hs @@ -44,14 +44,13 @@ currentAsciifyState = do Just state -> return state Nothing -> createEntity Proxy =<< AsciifyState <$> now -asciifyCooldown :: Reaction Message a -> Reaction Message a -asciifyCooldown next = +asciifyCooldown :: NominalDiffTime -> Reaction Message a -> Reaction Message a +asciifyCooldown cooldown next = Reaction $ \msg -> do state <- currentAsciifyState currentTime <- now let diff = diffUTCTime currentTime $ asciifyStateLastUsed $ entityPayload state - let cooldown = 2 * 60 if diff > cooldown then do void $ updateEntityById $ AsciifyState currentTime <$ state @@ -69,7 +68,7 @@ asciifyReaction = bttv <- bttvUrlByName name return (ffz <|> bttv)) $ replyOnNothing "Such emote does not exist" $ - asciifyCooldown $ + asciifyCooldown 60 $ byteStringHttpRequestReaction $ cmapR (braillizeByteString . BSL.toStrict) $ eitherReaction (Reaction (logMsg . T.pack . messageContent)) $