[−][src]Struct twilight_http::request::guild::ban::create_ban::CreateBan
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][−]
Attach an audit log reason to this request.
Trait Implementations
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][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T> FutureExt for T where
T: Future + ?Sized,
[src][+]
T: Future + ?Sized,
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<F, T, E> TryFuture for F where
F: Future<Output = Result<T, E>> + ?Sized,
[src][+]
F: Future<Output = Result<T, E>> + ?Sized,
impl<Fut> TryFutureExt for Fut where
Fut: TryFuture + ?Sized,
[src][+]
Fut: TryFuture + ?Sized,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,