Struct prelude::Member
zaun_bot::prelude::Member · Struct
pub struct Member { … }---- community objects ------------------------------------------------------------
Fields
Section titled “Fields”member_id: Id
Section titled “member_id: Id”display_name: String
Section titled “display_name: String”role_ids: Vec<Id>
Section titled “role_ids: Vec<Id>”joined_at: Timestamp
Section titled “joined_at: Timestamp”bot_id: Option<Id>
Section titled “bot_id: Option<Id>”Present only for bots.
voice_channel: Option<Id>
Section titled “voice_channel: Option<Id>”The voice channel the member is in, if any and if the bot can see that channel.
Always filled for an interaction’s invoker, so /play can join the caller.
Methods
Section titled “Methods”mention
Section titled “mention”pub fn mention(&self) -> StringThe text that shows a mention of this member: <@member_id>.
pub fn send<impl Into<Reply>>(&self, reply: impl Into<Reply>) -> Result<(Id, Id), HostError>Sends the member a direct message (capability dms), opening the DM when needed.
Returns the DM’s channel id and the message id.
Errors
Section titled “Errors”FORBIDDEN with detail dms_closed when the member does not take DMs from bots.
pub fn kick(&self, reason: Option<&str>) -> Result<(), HostError>Removes the member from the community (KICK_MEMBERS).
Errors
Section titled “Errors”The host’s refusal.
timeout
Section titled “timeout”pub fn timeout(&self, until: Option<Timestamp>, reason: Option<&str>) -> Result<(), HostError>Times the member out until until (ms since the epoch); None clears it
(TIMEOUT_MEMBERS).
Errors
Section titled “Errors”The host’s refusal.
add_role
Section titled “add_role”pub fn add_role(&self, role_id: &str) -> Result<(), HostError>Gives the member a role below the bot’s own (MANAGE_ROLES).
Errors
Section titled “Errors”The host’s refusal.
remove_role
Section titled “remove_role”pub fn remove_role(&self, role_id: &str) -> Result<(), HostError>Takes a role away (MANAGE_ROLES).
Errors
Section titled “Errors”The host’s refusal.
has_role
Section titled “has_role”pub fn has_role(&self, role_id: &str) -> boolWhether the member had role_id when the bot saw it.
is_bot
Section titled “is_bot”pub fn is_bot(&self) -> boolWhether the member is a bot.
Trait implementations
Section titled “Trait implementations”Clone, Debug