Safe Haskell | None |
---|---|
Language | Haskell2010 |
Discord
- module Discord.Types
- module Discord.Rest.Channel
- module Discord.Rest.Guild
- module Discord.Rest.User
- module Discord.Rest.Emoji
- data Cache = Cache {}
- data Gateway = Gateway {}
- newtype RestChan = RestChan (Chan (String, JsonRequest, MVar (Either RestCallException ByteString)))
- data RestCallException
- data GatewayException
- class Request a where
- data ThreadIdType
- restCall :: (FromJSON a, Request (r a)) => (RestChan, y, z) -> r a -> IO (Either RestCallException a)
- nextEvent :: (x, Gateway, z) -> IO (Either GatewayException Event)
- sendCommand :: (x, Gateway, z) -> GatewaySendable -> IO ()
- readCache :: (RestChan, Gateway, z) -> IO (Either GatewayException Cache)
- stopDiscord :: (x, y, [ThreadIdType]) -> IO ()
- loginRest :: Auth -> IO (RestChan, NotLoggedIntoGateway, [ThreadIdType])
- loginRestGateway :: Auth -> IO (RestChan, Gateway, [ThreadIdType])
Documentation
module Discord.Types
module Discord.Rest.Channel
module Discord.Rest.Guild
module Discord.Rest.User
module Discord.Rest.Emoji
Constructors
Cache | |
Concurrency primitives that make up the gateway. Build a higher level interface over these
Constructors
Gateway | |
Fields |
Constructors
RestChan (Chan (String, JsonRequest, MVar (Either RestCallException ByteString))) |
data RestCallException Source #
Constructors
RestCallErrorCode Int ByteString | |
RestCallNoParse String ByteString | |
RestCallHttpException HttpException |
Instances
data GatewayException Source #
Constructors
GatewayExceptionCouldNotConnect Text | |
GatewayExceptionEventParseError String Text | |
GatewayExceptionUnexpected GatewayReceivable Text | |
GatewayExceptionConnection ConnectionException Text |
Instances
class Request a where Source #
Minimal complete definition
Instances
Request (UserRequest a) Source # | |
Request (GuildRequest a) Source # | |
Request (EmojiRequest a) Source # | |
Request (ChannelRequest a) Source # | |
data ThreadIdType Source #
Thread Ids marked by what type they are
Constructors
ThreadRest ThreadId | |
ThreadGateway ThreadId | |
ThreadLogger ThreadId |
restCall :: (FromJSON a, Request (r a)) => (RestChan, y, z) -> r a -> IO (Either RestCallException a) Source #
Execute one http request and get a response
nextEvent :: (x, Gateway, z) -> IO (Either GatewayException Event) Source #
Block until the gateway produces another event. Once an exception is returned, only return that exception
sendCommand :: (x, Gateway, z) -> GatewaySendable -> IO () Source #
Send a GatewaySendable, but not Heartbeat, Identify, or Resume
readCache :: (RestChan, Gateway, z) -> IO (Either GatewayException Cache) Source #
Access the current state of the gateway cache
stopDiscord :: (x, y, [ThreadIdType]) -> IO () Source #
Stop all the background threads
loginRest :: Auth -> IO (RestChan, NotLoggedIntoGateway, [ThreadIdType]) Source #
Start HTTP rest handler background threads
loginRestGateway :: Auth -> IO (RestChan, Gateway, [ThreadIdType]) Source #
Start HTTP rest handler and gateway background threads