blob: 48d6641351be040c7e3a53dcf0c6bf6295206600 (
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
28
29
30
31
32
33
34
35
36
37
38
|
-- | The Discord Handle. Holds all the information related to the connection.
module Discord.Handle
( DiscordHandle(..)
, HandleThreadId(..)
) where
import Control.Concurrent (ThreadId, Chan, MVar)
import qualified Data.Text as T
import Discord.Internal.Rest (RestChanHandle(..))
import Discord.Internal.Gateway (GatewayHandle(..), CacheHandle(..))
-- | Thread Ids marked by what type they are
data HandleThreadId
= -- | A Rest API thread
HandleThreadIdRest ThreadId
| -- | A cache thread
HandleThreadIdCache ThreadId
| -- | A logger thread
HandleThreadIdLogger ThreadId
| -- | A gateway thread
HandleThreadIdGateway ThreadId
-- | The main Handle structure
data DiscordHandle = DiscordHandle
{ -- | Handle to the Rest loop
discordHandleRestChan :: RestChanHandle
, -- | Handle to the Websocket gateway event loop
discordHandleGateway :: GatewayHandle
, -- | Handle to the cache
discordHandleCache :: CacheHandle
, -- | List of the threads currently in use by the library
discordHandleThreads :: [HandleThreadId]
, -- | `Chan` used to send messages to the internal logger
discordHandleLog :: Chan T.Text
, -- | `MVar` containing a description of the latest library error
discordHandleLibraryError :: MVar T.Text
}
|