Safe Haskell | None |
---|---|
Language | Haskell2010 |
Discord
Synopsis
- module Discord.Types
- module Discord.Rest.Channel
- module Discord.Rest.Guild
- module Discord.Rest.User
- module Discord.Rest.Invite
- 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
- majorRoute :: a -> String
- jsonRequest :: a -> JsonRequest
- 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.Invite
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 ByteString | |
RestCallNoParse String ByteString | |
RestCallHttpException HttpException |
Instances
Show RestCallException Source # | |
Defined in Discord.Rest.HTTP Methods showsPrec :: Int -> RestCallException -> ShowS # show :: RestCallException -> String # showList :: [RestCallException] -> ShowS # |
data GatewayException Source #
Constructors
GatewayExceptionCouldNotConnect Text | |
GatewayExceptionEventParseError String Text | |
GatewayExceptionUnexpected GatewayReceivable Text | |
GatewayExceptionConnection ConnectionException Text |
Instances
Show GatewayException Source # | |
Defined in Discord.Gateway.EventLoop Methods showsPrec :: Int -> GatewayException -> ShowS # show :: GatewayException -> String # showList :: [GatewayException] -> ShowS # |
class Request a where Source #
Instances
Request (UserRequest a) Source # | |
Defined in Discord.Rest.User Methods majorRoute :: UserRequest a -> String Source # jsonRequest :: UserRequest a -> JsonRequest Source # | |
Request (InviteRequest a) Source # | |
Defined in Discord.Rest.Invite Methods majorRoute :: InviteRequest a -> String Source # jsonRequest :: InviteRequest a -> JsonRequest Source # | |
Request (GuildRequest a) Source # | |
Defined in Discord.Rest.Guild Methods majorRoute :: GuildRequest a -> String Source # jsonRequest :: GuildRequest a -> JsonRequest Source # | |
Request (EmojiRequest a) Source # | |
Defined in Discord.Rest.Emoji Methods majorRoute :: EmojiRequest a -> String Source # jsonRequest :: EmojiRequest a -> JsonRequest Source # | |
Request (ChannelRequest a) Source # | |
Defined in Discord.Rest.Channel Methods majorRoute :: ChannelRequest a -> String Source # jsonRequest :: ChannelRequest a -> JsonRequest 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