|
@ -38,6 +38,7 @@ import Commands.EDT (getEdt) |
|
|
import qualified Control.Concurrent |
|
|
import qualified Control.Concurrent |
|
|
import qualified Control.Event as E |
|
|
import qualified Control.Event as E |
|
|
import UnliftIO.Directory (doesFileExist, removeFile) |
|
|
import UnliftIO.Directory (doesFileExist, removeFile) |
|
|
|
|
|
import Data.Time (getCurrentTime) |
|
|
|
|
|
|
|
|
main :: IO () |
|
|
main :: IO () |
|
|
main = do |
|
|
main = do |
|
@ -75,9 +76,11 @@ onDiscordStart conf eventSystem = do |
|
|
remindfile <- liftIO $ readFile "reminds.data" |
|
|
remindfile <- liftIO $ readFile "reminds.data" |
|
|
let reminddata :: [Remind] |
|
|
let reminddata :: [Remind] |
|
|
reminddata = map read $ lines remindfile |
|
|
reminddata = map read $ lines remindfile |
|
|
|
|
|
now <- liftIO getCurrentTime |
|
|
mapM_ (\r -> do |
|
|
mapM_ (\r -> do |
|
|
withRunInIO $ \runInIO -> |
|
|
withRunInIO $ \runInIO -> |
|
|
E.addEvent eventSystem (rmdWhen r) |
|
|
|
|
|
|
|
|
if now > rmdWhen r then |
|
|
|
|
|
void $ E.addEvent eventSystem (rmdWhen r) |
|
|
( do |
|
|
( do |
|
|
runInIO ( restCall |
|
|
runInIO ( restCall |
|
|
$ R.CreateMessage (rmdWhere r) |
|
|
$ R.CreateMessage (rmdWhere r) |
|
@ -88,6 +91,8 @@ onDiscordStart conf eventSystem = do |
|
|
) |
|
|
) |
|
|
return () |
|
|
return () |
|
|
) |
|
|
) |
|
|
|
|
|
else |
|
|
|
|
|
pure () |
|
|
) reminddata |
|
|
) reminddata |
|
|
liftIO $ removeFile "reminds.data" |
|
|
liftIO $ removeFile "reminds.data" |
|
|
|
|
|
|
|
|