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 fn after(self, user_id: Id<UserMarker>) -> Self
pub fn after(self, user_id: Id<UserMarker>) -> Self
sourcepub fn before(self, user_id: Id<UserMarker>) -> Self
pub 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> Freeze for GetBans<'a>
impl<'a> !RefUnwindSafe for GetBans<'a>
impl<'a> Send for GetBans<'a>
impl<'a> Sync for GetBans<'a>
impl<'a> Unpin for GetBans<'a>
impl<'a> !UnwindSafe for GetBans<'a>
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