Skip to main content

Member

Struct Member 

Source
pub struct Member { /* private fields */ }
Expand description

A member of a community.

Implementations§

Source§

impl Member

Source

pub fn dm(&self) -> Result<Channel>

The DM with this member, opened if needed (a bot DMs a member; a member DMs a bot).

§Errors

FORBIDDEN{reason:"dms_closed"}, RATE_LIMITED{category:"dms"}, NOT_FOUND, or no answer.

Source

pub fn send(&self, options: impl Into<MessageOptions>) -> Result<Message>

Sends this member a direct message: opens the DM, then posts in it.

§Errors

What dm and Channel::send refuse.

Source§

impl Member

Source

pub fn presence(&self) -> Presence

What this member is doing and whether they are online (offline when unknown).

Source

pub fn status_text(&self) -> Option<String>

Their custom status text, if they set one.

Source

pub fn status_emoji(&self) -> Option<String>

Their custom status emoji, if they set one.

Source§

impl Member

Source

pub fn bot_id(&self) -> Option<BotId>

The bot this member is, if it is one.

Source

pub fn is_bot(&self) -> bool

Whether this member is a bot.

Source§

impl Member

Source

pub fn can_use(&self, command: &ApplicationCommand, channel: &Channel) -> bool

Whether this member may use command in channel (a local view; the host decides).

Source§

impl Member

Source

pub fn mention(&self) -> String

The text that shows a mention of this member, <@id>.

Source§

impl Member

Source

pub const fn id(&self) -> MemberId

Its id.

Source

pub const fn community(&self) -> &Community

The community it belongs to.

Source

pub fn data(&self) -> Option<MemberData>

The cache’s copy, or None before the cache heard of this member (Community::fetch_members).

Source

pub fn display_name(&self) -> String

Their name in this community.

Source

pub fn is_me(&self) -> bool

Whether this member is this client.

Source

pub fn roles(&self) -> Vec<Role>

Their roles.

Source

pub fn timed_out_until(&self) -> Option<u64>

When a timeout ends, ms since the epoch; None when not timed out.

Source

pub fn permissions(&self, channel: Option<&Channel>) -> Permissions

What this member may do in the community, or in channel, as the cache sees it; the host still decides.

Source

pub fn can(&self, permission: Permissions, channel: Option<&Channel>) -> bool

Whether this member has permission (in channel), as the cache sees it.

Source

pub fn add_role(&self, role: &Role) -> Result<()>

Gives this member role.

§Errors

The host refused (no MANAGE_ROLES, or a role above this member’s) or did not answer.

Source

pub fn remove_role(&self, role: &Role) -> Result<()>

Takes role from this member.

§Errors

As add_role.

Source

pub fn set_roles(&self, add: &[&Role], remove: &[&Role]) -> Result<()>

Adds and removes roles in one command.

§Errors

As add_role.

Source

pub fn kick(&self, reason: Option<&str>) -> Result<()>

Removes this member; they may join again with a new invitation.

§Errors

The host refused (no KICK_MEMBERS, or a member above this one) or did not answer.

Source

pub fn ban(&self, reason: Option<&str>) -> Result<()>

Removes this member and keeps them out.

§Errors

The host refused (no BAN_MEMBERS) or did not answer.

Source

pub fn timeout( &self, duration: Option<Duration>, reason: Option<&str>, ) -> Result<()>

Times this member out for duration, or lifts it with None.

§Errors

The host refused (no TIMEOUT_MEMBERS) or did not answer.

Source

pub fn fingerprint(&self) -> Option<String>

The fingerprint of this member’s key (this client’s own, or the one pinned on first sight), to compare out of band.

Trait Implementations§

Source§

impl Clone for Member

Source§

fn clone(&self) -> Member

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 Member

Source§

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

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

impl Display for Member

Source§

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

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

impl PartialEq for Member

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

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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
§

impl<T> CryptoSafe for T
where T: Send + Sync + Debug,

§

impl<T> CryptoSafe for T

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more