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)?
    .exec()
    .await?;
let bans = response.models().await?;

for ban in bans {
    println!("{} was banned for: {:?}", ban.user.name, ban.reason);
}

Implementations

Set the user ID after which to retrieve bans.

Mutually exclusive with before. If both are provided then before is respected.

Set the user ID before which to retrieve bans.

Mutually exclusive with after. If both are provided then before is respected.

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.

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

Trait Implementations

Try to convert a request builder into a raw Request. Read more

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

Returns the argument unchanged.

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more