summaryrefslogtreecommitdiff
path: root/deps/discord-haskell/examples/cache.hs
blob: 2e26f53793a0d173758cf83ac9c51ef30259edb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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 ()