Available on crate feature
client
only.Expand description
The Client contains information about a single bot’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 http
module and Cache
are also automatically
handled by the Client module for you.
A Context
is provided for every handler.
The http
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 http
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
.
Re-exports
pub use crate::cache::Cache;
Structs
- Client
gateway
The Client is the way to be able to start sending authenticated requests over the REST API, as well as initializing a WebSocket connection throughShard
s. Refer to the documentation on using sharding for more information. - ClientBuilder
gateway
A builder implementingIntoFuture
building aClient
to interact with Discord.
Enums
- An error returned from the
Client
. - FullEvent
gateway
This enum stores every possible event that anEventHandler
can receive.
Traits
- EventHandler
gateway
The core trait for handling events by serenity. - RawEventHandler
gateway
This core trait for handling raw events