Struct Member
zaun_client::Member · Struct
pub struct Member { … }A member of a community.
Methods
Section titled “Methods”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
Section titled “Errors”FORBIDDEN{reason:"dms_closed"}, RATE_LIMITED{category:"dms"}, NOT_FOUND, or no
answer.
pub fn send<impl Into<MessageOptions>>(&self, options: impl Into<MessageOptions>) -> Result<Message>Sends this member a direct message: opens the DM, then posts in it.
Errors
Section titled “Errors”What dm and Channel::send refuse.
presence
Section titled “presence”pub fn presence(&self) -> PresenceWhat this member is doing and whether they are online (offline when unknown).
status_text
Section titled “status_text”pub fn status_text(&self) -> Option<String>Their custom status text, if they set one.
status_emoji
Section titled “status_emoji”pub fn status_emoji(&self) -> Option<String>Their custom status emoji, if they set one.
bot_id
Section titled “bot_id”pub fn bot_id(&self) -> Option<BotId>The bot this member is, if it is one.
is_bot
Section titled “is_bot”pub fn is_bot(&self) -> boolWhether this member is a bot.
can_use
Section titled “can_use”pub fn can_use(&self, command: &ApplicationCommand, channel: &Channel) -> boolWhether this member may use command in channel (a local view; the host decides).
mention
Section titled “mention”pub fn mention(&self) -> StringThe text that shows a mention of this member, <@id>.
pub const fn id(&self) -> MemberIdIts id.
community
Section titled “community”pub const fn community(&self) -> &CommunityThe community it belongs to.
pub fn data(&self) -> Option<MemberData>The cache’s copy, or None before the cache heard of this member
(Community::fetch_members).
display_name
Section titled “display_name”pub fn display_name(&self) -> StringTheir name in this community.
pub fn is_me(&self) -> boolWhether this member is this client.
pub fn roles(&self) -> Vec<Role>Their roles.
timed_out_until
Section titled “timed_out_until”pub fn timed_out_until(&self) -> Option<u64>When a timeout ends, ms since the epoch; None when not timed out.
permissions
Section titled “permissions”pub fn permissions(&self, channel: Option<&Channel>) -> PermissionsWhat this member may do in the community, or in channel, as the cache sees it; the
host still decides.
pub fn can(&self, permission: Permissions, channel: Option<&Channel>) -> boolWhether this member has permission (in channel), as the cache sees it.
add_role
Section titled “add_role”pub fn add_role(&self, role: &Role) -> Result<()>Gives this member role.
Errors
Section titled “Errors”The host refused (no MANAGE_ROLES, or a role above this member’s) or did not answer.
remove_role
Section titled “remove_role”pub fn remove_role(&self, role: &Role) -> Result<()>Takes role from this member.
Errors
Section titled “Errors”As add_role.
set_roles
Section titled “set_roles”pub fn set_roles(&self, add: &[&Role], remove: &[&Role]) -> Result<()>Adds and removes roles in one command.
Errors
Section titled “Errors”As add_role.
pub fn kick(&self, reason: Option<&str>) -> Result<()>Removes this member; they may join again with a new invitation.
Errors
Section titled “Errors”The host refused (no KICK_MEMBERS, or a member above this one) or did not answer.
pub fn ban(&self, reason: Option<&str>) -> Result<()>Removes this member and keeps them out.
Errors
Section titled “Errors”The host refused (no BAN_MEMBERS) or did not answer.
timeout
Section titled “timeout”pub fn timeout(&self, duration: Option<Duration>, reason: Option<&str>) -> Result<()>Times this member out for duration, or lifts it with None.
Errors
Section titled “Errors”The host refused (no TIMEOUT_MEMBERS) or did not answer.
fingerprint
Section titled “fingerprint”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
Section titled “Trait implementations”Clone, Debug, Display, PartialEq