Skip to main content

RequestGuildMembers

Struct RequestGuildMembers 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§guild_id: GuildId

The 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: bool

Whether 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

Source

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.

Source

pub fn all(guild_id: GuildId) -> Self

Requests all members (requires the GUILD_MEMBERS intent).

discord.js counterpart: GuildMemberManager#fetch without options.

Source

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.

Trait Implementations§

Source§

impl Clone for RequestGuildMembers

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RequestGuildMembers

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RequestGuildMembers

Source§

impl GatewayCommand for RequestGuildMembers

Source§

const OPCODE: OpCode = OpCode::RequestGuildMembers

The opcode of the command.
Source§

impl PartialEq for RequestGuildMembers

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for RequestGuildMembers

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RequestGuildMembers

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.