twilight_http

Module request

source
Expand description

Typed request builders, multipart form support, a manual request builder for low-level request construction, and audit log reason support.

§Request Builders

Requests are created in the form of builders. These can be awaited to receive a Response. Every route of Discord’s API has its own builder: creating a message is performed via the CreateMessage builder; updating a guild is done via UpdateGuild; and so on. All typed request builders are instantiated via the primary Client. When the library doesn’t yet support a new feature or fine-grained support is required, requests can be manually built via RequestBuilder.

§Audit Log Reasons

Audit log reasons can be added to supported requests via the AuditLogReason trait:

use twilight_http::{client::Client, request::AuditLogReason};

let client = Client::new(std::env::var("DISCORD_TOKEN")?);
client
    .delete_ban(guild_id, user_id)
    .reason("ban expired")
    .await?;

Modules§

Structs§

Enums§

Traits§