Module serenity::client[][src]

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;
pub use crate::CacheAndHttp;

Modules

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

Structs

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.

A builder implementing Future building a Client to interact with Discord.

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.

A builder to extra things for altering the Client.

Part of the data contained within a Discord bot token. Returned by parse_token.

Enums

An error returned from the Client.

Traits

The core trait for handling events by serenity.

This core trait for handling raw events

Functions

Verifies that the token adheres to the Discord token format and extracts the bot user ID and the token generation timestamp

Validates that a token is likely in a valid format.