Struct twilight_http::request::guild::ban::create_ban::CreateBan [−][src]
pub struct CreateBan<'a> { /* fields omitted */ }
Expand description
Bans a user from a guild, optionally with the number of days’ worth of messages to delete and the reason.
Examples
Ban user 200
from guild 100
, deleting
1 day’s worth of messages, for the reason "memes"
:
use twilight_http::{request::AuditLogReason, Client}; use twilight_model::id::{GuildId, UserId}; let client = Client::new("my token".to_owned()); let guild_id = GuildId(100); let user_id = UserId(200); client.create_ban(guild_id, user_id) .delete_message_days(1)? .reason("memes")? .exec() .await?;
Implementations
Set the number of days’ worth of messages to delete.
The number of days must be less than or equal to 7.
Errors
Returns a CreateBanErrorType::DeleteMessageDaysInvalid
error type if
the number of days is greater than 7.
pub fn exec(self) -> ResponseFuture<EmptyBody>ⓘNotable traits for ResponseFuture<T>impl<T: Unpin> Future for ResponseFuture<T> type Output = Result<Response<T>, Error>;
pub fn exec(self) -> ResponseFuture<EmptyBody>ⓘNotable traits for ResponseFuture<T>impl<T: Unpin> Future for ResponseFuture<T> type Output = Result<Response<T>, Error>;
Notable traits for ResponseFuture<T>
impl<T: Unpin> Future for ResponseFuture<T> type Output = Result<Response<T>, Error>;
Execute the request, returning a future resolving to a Response
.