pub struct Member { /* private fields */ }Expand description
A member of a community.
Implementations§
Source§impl Member
impl Member
Sourcepub fn dm(&self) -> Result<Channel>
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.
Sourcepub fn send(&self, options: impl Into<MessageOptions>) -> Result<Message>
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
impl Member
Sourcepub fn presence(&self) -> Presence
pub fn presence(&self) -> Presence
What this member is doing and whether they are online (offline when unknown).
Sourcepub fn status_text(&self) -> Option<String>
pub fn status_text(&self) -> Option<String>
Their custom status text, if they set one.
Sourcepub fn status_emoji(&self) -> Option<String>
pub fn status_emoji(&self) -> Option<String>
Their custom status emoji, if they set one.
Source§impl Member
impl Member
Sourcepub fn data(&self) -> Option<MemberData>
pub fn data(&self) -> Option<MemberData>
The cache’s copy, or None before the cache heard of this member
(Community::fetch_members).
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
Their name in this community.
Sourcepub fn timed_out_until(&self) -> Option<u64>
pub fn timed_out_until(&self) -> Option<u64>
When a timeout ends, ms since the epoch; None when not timed out.
Sourcepub fn permissions(&self, channel: Option<&Channel>) -> Permissions
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.
Sourcepub fn can(&self, permission: Permissions, channel: Option<&Channel>) -> bool
pub fn can(&self, permission: Permissions, channel: Option<&Channel>) -> bool
Whether this member has permission (in channel), as the cache sees it.
Sourcepub fn add_role(&self, role: &Role) -> Result<()>
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.
Sourcepub fn remove_role(&self, role: &Role) -> Result<()>
pub fn remove_role(&self, role: &Role) -> Result<()>
Sourcepub fn kick(&self, reason: Option<&str>) -> Result<()>
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.
Sourcepub fn ban(&self, reason: Option<&str>) -> Result<()>
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.
Sourcepub fn timeout(
&self,
duration: Option<Duration>,
reason: Option<&str>,
) -> Result<()>
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.
Sourcepub fn fingerprint(&self) -> Option<String>
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.