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 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.

Reexports

pub use gateway;
pub use http as rest;
pub use CACHE;

Modules

bridge

A collection of bridged support between the client module and other modules.

Structs

Client

The Client is the way to be able to start sending authenticated requests over the REST API, as well as initializing a WebSocket connection through Shards. Refer to the documentation on using sharding for more information.

Context

The context is a general utility struct provided on event dispatches, which helps with dealing with the current "context" of the event dispatch. The context also acts as a general high-level interface over the associated Shard which received the event, or the low-level http module.

Enums

ClientError

An error returned from the Client.

Traits

EventHandler

Functions

validate_token

Validates that a token is likely in a valid format.