Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Provides a rather raw interface to the websocket events through a real-time Chan
Synopsis
- data GatewayHandle = GatewayHandle {
- gatewayHandleEvents :: Chan (Either GatewayException EventInternalParse)
- gatewayHandleUserSendables :: Chan GatewaySendable
- gatewayHandleLastStatus :: IORef (Maybe UpdateStatusOpts)
- gatewayHandleLastSequenceId :: IORef Integer
- gatewayHandleSessionId :: IORef Text
- gatewayHandleHostname :: IORef HostName
- gatewayHandleHeartbeatAckTimes :: IORef UTCTime
- gatewayHandleHeartbeatTimes :: IORef (UTCTime, UTCTime)
- data CacheHandle = CacheHandle {}
- newtype GatewayException = GatewayExceptionIntent Text
- data Cache = Cache {
- cacheCurrentUser :: !User
- cacheDMChannels :: !(Map ChannelId Channel)
- cacheGuilds :: !(Map GuildId (Maybe (Guild, Maybe GuildCreateData)))
- cacheChannels :: !(Map ChannelId Channel)
- cacheApplication :: !FullApplication
- initializeCache :: User -> FullApplication -> CacheHandle -> IO ()
- startCacheThread :: Bool -> Chan Text -> IO (CacheHandle, ThreadId)
- startGatewayThread :: Auth -> GatewayIntent -> CacheHandle -> Chan Text -> IO (GatewayHandle, ThreadId)
- data Auth
- data EventInternalParse
- data GatewayIntent
Documentation
data GatewayHandle Source #
Info the event processing loop needs to
GatewayHandle | |
|
data CacheHandle Source #
Internal handle for cacheLoop to manage the cache
CacheHandle | |
|
newtype GatewayException Source #
Ways the gateway connection can fail with no possibility of recovery.
Instances
Show GatewayException Source # | |
Defined in Discord.Internal.Gateway.EventLoop showsPrec :: Int -> GatewayException -> ShowS # show :: GatewayException -> String # showList :: [GatewayException] -> ShowS # |
Cached data from gateway. Set RunDiscordOpts.discordEnableCache=true to enable all the fields
Cache | |
|
initializeCache :: User -> FullApplication -> CacheHandle -> IO () Source #
Internally used to setup the first cache
startCacheThread :: Bool -> Chan Text -> IO (CacheHandle, ThreadId) Source #
Starts a thread for the cache
startGatewayThread :: Auth -> GatewayIntent -> CacheHandle -> Chan Text -> IO (GatewayHandle, ThreadId) Source #
Create a Chan for websockets. This creates a thread that writes all the received EventsInternalParse to the Chan
Authorization token for the Discord API
data EventInternalParse Source #
Internal Event representation. Each matches to the corresponding constructor of Event
.
An application should never have to use those directly
Instances
Read EventInternalParse Source # | |
Defined in Discord.Internal.Types.Events | |
Show EventInternalParse Source # | |
Defined in Discord.Internal.Types.Events showsPrec :: Int -> EventInternalParse -> ShowS # show :: EventInternalParse -> String # showList :: [EventInternalParse] -> ShowS # | |
Eq EventInternalParse Source # | |
Defined in Discord.Internal.Types.Events (==) :: EventInternalParse -> EventInternalParse -> Bool # (/=) :: EventInternalParse -> EventInternalParse -> Bool # |
data GatewayIntent Source #
Gateway intents to subrscribe to
Details of which intent englobs what data is avalilable at the official Discord documentation