Module serenity::client
[−]
[src]
The Client contains information about a single bot or user's token, as well
as event handlers. Dispatching events to configured handlers and starting
the shards' connections are handled directly via the client. In addition,
the rest
module and Cache
are also automatically handled by the
Client module for you.
A Context
is provided for every handler. The context is an ergonomic
method of accessing the lower-level HTTP functions.
The rest
module is the lower-level method of interacting with the Discord
REST API. Realistically, there should be little reason to use this yourself,
as the Context will do this for you. A possible use case of using the rest
module is if you do not have a Cache, for purposes such as low memory
requirements.
Click here for an example on how to use a Client
.
Modules
gateway |
The gateway module contains the pieces - primarily the |
rest |
The HTTP module which provides functions for performing requests to endpoints in Discord's API. |
Structs
CACHE |
A mutable and lazily-initialized static binding. It can be accessed across any function and in any context. |
Client |
The Client is the way to "login" and be able to start sending authenticated
requests over the REST API, as well as initializing a WebSocket connection
through |
Context |
The context is a general utility struct provided on event dispatches, which
helps with dealing with the current "context" of the event dispatch,
and providing helper methods where possible. The context also acts as a
general high-level interface over the associated |
Enums
ClientError |
An error returned from the |
LoginType |
The type of login to perform. |
Functions
validate_token |
Validates that a token is likely in a valid format. |