pub struct GetBans<'a> { /* private fields */ }Expand description
Retrieve the bans for a guild.
§Examples
Retrieve the first 25 bans of a guild after a particular user ID:
use std::env;
use twilight_http::Client;
use twilight_model::id::Id;
let client = Client::new(env::var("DISCORD_TOKEN")?);
let guild_id = Id::new(1);
let user_id = Id::new(2);
let response = client.bans(guild_id).after(user_id).limit(25).await?;
let bans = response.models().await?;
for ban in bans {
println!("{} was banned for: {:?}", ban.user.name, ban.reason);
}Implementations§
Source§impl<'a> GetBans<'a>
impl<'a> GetBans<'a>
Sourcepub const fn after(self, user_id: Id<UserMarker>) -> Self
pub const fn after(self, user_id: Id<UserMarker>) -> Self
Sourcepub const fn before(self, user_id: Id<UserMarker>) -> Self
pub const fn before(self, user_id: Id<UserMarker>) -> Self
Sourcepub fn limit(self, limit: u16) -> Self
pub fn limit(self, limit: u16) -> Self
Set the maximum number of bans to retrieve.
Defaults to Discord’s default.
Refer to [Discord Docs/Get Guild Bans] for more information.
§Errors
Returns an error of type GetGuildBans if the limit is invalid.
Trait Implementations§
Source§impl IntoFuture for GetBans<'_>
impl IntoFuture for GetBans<'_>
Source§type Output = Result<Response<ListBody<Ban>>, Error>
type Output = Result<Response<ListBody<Ban>>, Error>
The output that the future will produce on completion.
Source§type IntoFuture = ResponseFuture<ListBody<Ban>>
type IntoFuture = ResponseFuture<ListBody<Ban>>
Which kind of future are we turning this into?
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for GetBans<'a>
impl<'a> !UnwindSafe for GetBans<'a>
impl<'a> Forget for GetBans<'a>
impl<'a> Freeze for GetBans<'a>where
PhantomData<fn(UserMarker) -> UserMarker>: Freeze,
NonZero<u64>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
NonZero<i32>: Freeze,
&'static str: Freeze,
PhantomData<fn(GuildMarker) -> GuildMarker>: Freeze,
&'a Client: Freeze,
impl<'a> Move for GetBans<'a>
impl<'a> Send for GetBans<'a>
impl<'a> Sync for GetBans<'a>where
NonZero<u64>: Sync,
RawVecInner: Sync,
NonZero<i32>: Sync,
BoxRaw<[Pos]>: Sync,
Bytes: Sync,
Arc<Config>: Sync,
Arc<Resolver<GenericConnector<TokioRuntimeProvider>>>: Sync,
Arc<ClientConfig>: Sync,
Arc<dyn ResolveServerName + Send + Sync>: Sync,
Arc<dyn Executor<Pin<Box<dyn Future<Output = ()> + Send>>> + Send + Sync>: Sync,
Arc<dyn Timer + Send + Sync>: Sync,
Arc<Mutex<PoolInner<PoolClient<Full<Bytes>>, (Scheme, Authority)>>>: Sync,
BoxRaw<str>: Sync,
Arc<Chan<(Message, Option<Box<dyn FnOnce(Option<Bucket>) -> bool + Send>>), Semaphore>>: Sync,
Arc<Atomic<bool>>: Sync,
impl<'a> Unpin for GetBans<'a>
impl<'a> UnsafeUnpin for GetBans<'a>where
PhantomData<fn(UserMarker) -> UserMarker>: UnsafeUnpin,
NonZeroU64Inner: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
NonZeroI32Inner: UnsafeUnpin,
&'static str: UnsafeUnpin,
PhantomData<fn(GuildMarker) -> GuildMarker>: UnsafeUnpin,
&'a Client: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more