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 await
ed 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§
- application
- attachment
- channel
- guild
- poll
- scheduled_
event - Request builders for interacting with scheduled events.
- sticker
- template
- user
Structs§
- Form
- GetCurrent
Authorization Information - Retrieve information about the current OAuth2 authorization.
- GetGateway
- Get information about the gateway, optionally with additional information detailing the number of shards to use and sessions remaining.
- GetGateway
Authed - Get information about the gateway, authenticated as a bot user.
- GetUser
Application Info - GetVoice
Regions - Get a list of voice regions that can be used when creating a guild.
- Request
- Request
Builder - Builder to create a customized request.
- Update
Current User Application - Update the current user’s application.
Enums§
Traits§
- Audit
LogReason - Attach a reason for a request.
- TryInto
Request - Convert a typed request builder into a raw
Request
.