#[non_exhaustive]pub struct RequestGuildMembers {
pub guild_id: GuildId,
pub query: Option<CompactString>,
pub limit: Option<u32>,
pub presences: bool,
pub user_ids: Vec<UserId>,
pub nonce: Option<CompactString>,
}Expand description
Request Guild Members
(opcode 8): asks for members of a guild; they arrive in
GuildMembersChunk events.
Requesting all members (or presences) requires the GUILD_MEMBERS (or GUILD_PRESENCES)
intent; it is rate limited (RateLimited).
discord.js counterpart: GuildMemberManager#fetch (over the gateway).
§Examples
use djs_model::{gateway::payload::{CommandPayload, RequestGuildMembers}, id::GuildId};
let request = RequestGuildMembers::query(GuildId::new(41771983423143937), "mix", 10);
assert_eq!(
serde_json::to_string(&CommandPayload::new(&request)).unwrap(),
r#"{"op":8,"d":{"guild_id":"41771983423143937","query":"mix","limit":10}}"#
);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.guild_id: GuildIdThe guild.
query: Option<CompactString>The prefix usernames must start with ("" for all members).
limit: Option<u32>The maximum number of members for a query (0 with an empty query: all members).
presences: boolWhether to include the members’ presences.
user_ids: Vec<UserId>The users to fetch (instead of a query).
nonce: Option<CompactString>A nonce returned in the chunks (max 32 bytes).
Implementations§
Source§impl RequestGuildMembers
impl RequestGuildMembers
Sourcepub fn query(
guild_id: GuildId,
query: impl Into<CompactString>,
limit: u32,
) -> Self
pub fn query( guild_id: GuildId, query: impl Into<CompactString>, limit: u32, ) -> Self
Requests the members whose username starts with query, at most limit.
discord.js counterpart: the query and limit options of GuildMemberManager#fetch.
Sourcepub fn all(guild_id: GuildId) -> Self
pub fn all(guild_id: GuildId) -> Self
Requests all members (requires the GUILD_MEMBERS intent).
discord.js counterpart: GuildMemberManager#fetch without options.
Sourcepub fn users(
guild_id: GuildId,
user_ids: impl IntoIterator<Item = UserId>,
) -> Self
pub fn users( guild_id: GuildId, user_ids: impl IntoIterator<Item = UserId>, ) -> Self
Requests the given users (up to 100).
discord.js counterpart: the user option of GuildMemberManager#fetch.