summaryrefslogtreecommitdiff
path: root/deps/discord-haskell/examples/cache.hs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2023-11-16 19:06:43 -0500
committerLLLL Colonq <llll@colonq>2023-11-16 19:06:43 -0500
commitdcef0b65069fb38fd0f6c4382353167f603ebff1 (patch)
tree45954ffe308c3dd056e6af4f734e6d2af89e5856 /deps/discord-haskell/examples/cache.hs
Initial commit
Diffstat (limited to 'deps/discord-haskell/examples/cache.hs')
-rw-r--r--deps/discord-haskell/examples/cache.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/deps/discord-haskell/examples/cache.hs b/deps/discord-haskell/examples/cache.hs
new file mode 100644
index 0000000..2e26f53
--- /dev/null
+++ b/deps/discord-haskell/examples/cache.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+import UnliftIO (liftIO)
+
+import Discord
+
+import ExampleUtils (getToken)
+
+main :: IO ()
+main = cacheExample
+
+-- There's not much information in the Cache for now
+-- but this program will show you what its got
+
+-- | Print cached Gateway info
+cacheExample :: IO ()
+cacheExample = do
+ tok <- getToken
+
+ _ <- runDiscord $ def { discordToken = tok
+ , discordOnStart = do
+ cache <- readCache
+ liftIO $ putStrLn ("Cached info from gateway: " <> show cache)
+ stopDiscord
+ }
+ pure ()
+