[][src]Struct twilight_http::request::guild::ban::create_ban::CreateBan

pub struct CreateBan<'a> { /* fields omitted */ }

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::Client;
use twilight_model::id::{GuildId, UserId};

let client = Client::new("my token");

let guild_id = GuildId(100);
let user_id = UserId(200);
client.create_ban(guild_id, user_id)
    .delete_message_days(1)?
    .reason("memes")
    .await?;

Implementations

impl<'a> CreateBan<'a>[src]

pub fn delete_message_days(self, days: u64) -> Result<Self, CreateBanError>[src]

Set the number of days' worth of messages to delete.

The number of days must be less than or equal to 7.

Errors

Returns CreateBanError::DeleteMessageDaysInvalid if the number of days is greater than 7.

pub fn reason(self, reason: impl Into<String>) -> Self[src]

👎 Deprecated since 0.1.5:

please prefer the request::AuditLogReason trait

Attach an audit log reason to this request.

Trait Implementations

impl<'a> AuditLogReason for CreateBan<'a>[src]

impl<'_> Future for CreateBan<'_>[src]

type Output = Result<()>

The type of value produced on completion.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for CreateBan<'a>

impl<'a> Send for CreateBan<'a>

impl<'a> !Sync for CreateBan<'a>

impl<'a> Unpin for CreateBan<'a>

impl<'a> !UnwindSafe for CreateBan<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FutureExt for T where
    T: Future + ?Sized
[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<F, T, E> TryFuture for F where
    F: Future<Output = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<Fut> TryFutureExt for Fut where
    Fut: TryFuture + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.