[−][src]Struct twilight_model::gateway::payload::request_guild_members::RequestGuildMembersBuilder
Implementations
impl RequestGuildMembersBuilder
[src]
pub fn new(guild_id: GuildId) -> Self
[src]
Create a new builder to configure and construct a
RequestGuildMembers
.
pub fn nonce(self, nonce: impl Into<String>) -> Self
[src]
Set the nonce to identify the member chunk response.
By default, this uses Discord's default.
pub fn presences(mut self: Self, presences: bool) -> Self
[src]
Request that guild members' presences are included in member chunks.
By default, this uses Discord's default.
pub fn query(
self,
query: impl Into<String>,
limit: Option<u64>
) -> RequestGuildMembers
[src]
self,
query: impl Into<String>,
limit: Option<u64>
) -> RequestGuildMembers
Consume the builder, creating a request for users whose usernames start with the provided string and optionally limiting the number of members to retrieve.
If you specify no limit, then Discord's default will be used, which will be an unbounded number of members. Specifying 0 is also equivalent.
To request the entire member list, pass in a None
query. You must also
have the GUILD_MEMBERS
intent enabled.
Examples
Request all of the guild members that start with the letter "a" and their presences:
use twilight_model::{gateway::payload::RequestGuildMembers, id::GuildId}; let request = RequestGuildMembers::builder(GuildId(1)) .presences(true) .query("a", None); assert_eq!(GuildId(1), request.d.guild_id); assert_eq!(Some(0), request.d.limit); assert_eq!(Some("a"), request.d.query.as_deref()); assert_eq!(Some(true), request.d.presences);
pub fn user_id(self, user_id: UserId) -> RequestGuildMembers
[src]
Consume the builder, creating a request that requests the provided member in the specified guild(s).
Examples
Request a member within a guild and specify a nonce of "test":
use twilight_model::{ gateway::payload::request_guild_members::{RequestGuildMemberId, RequestGuildMembers}, id::{GuildId, UserId}, }; let request = RequestGuildMembers::builder(GuildId(1)) .nonce("test") .user_id(UserId(2)); assert_eq!(Some(RequestGuildMemberId::One(UserId(2))), request.d.user_ids);
pub fn user_ids(
self,
user_ids: impl Into<Vec<UserId>>
) -> Result<RequestGuildMembers, UserIdsError>
[src]
self,
user_ids: impl Into<Vec<UserId>>
) -> Result<RequestGuildMembers, UserIdsError>
Consume the builder, creating a request that requests the provided user(s) in the specified guild(s).
Only up to 100 user IDs can be requested at once.
Examples
Request two members within one guild and specify a nonce of "test":
use twilight_model::{ gateway::payload::request_guild_members::{RequestGuildMemberId, RequestGuildMembers}, id::{GuildId, UserId}, }; let request = RequestGuildMembers::builder(GuildId(1)) .nonce("test") .user_ids(vec![UserId(2), UserId(3)])?; assert!(matches!(request.d.user_ids, Some(RequestGuildMemberId::Multiple(ids)) if ids.len() == 2));
Errors
Returns UserIdsError::TooMany
if more than 100 user IDs were
provided.
Auto Trait Implementations
impl RefUnwindSafe for RequestGuildMembersBuilder
[src]
impl Send for RequestGuildMembersBuilder
[src]
impl Sync for RequestGuildMembersBuilder
[src]
impl Unpin for RequestGuildMembersBuilder
[src]
impl UnwindSafe for RequestGuildMembersBuilder
[src]
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
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>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,