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.

Execute the request, returning a future resolving to a Response.

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.