Skip to content

Struct prelude::Member

zaun_bot::prelude::Member · Struct

pub struct Member { … }

---- community objects ------------------------------------------------------------

Present only for bots.

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.

pub fn mention(&self) -> String

The 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.

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).

The host’s refusal.

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).

The host’s refusal.

pub fn add_role(&self, role_id: &str) -> Result<(), HostError>

Gives the member a role below the bot’s own (MANAGE_ROLES).

The host’s refusal.

pub fn remove_role(&self, role_id: &str) -> Result<(), HostError>

Takes a role away (MANAGE_ROLES).

The host’s refusal.

pub fn has_role(&self, role_id: &str) -> bool

Whether the member had role_id when the bot saw it.

pub fn is_bot(&self) -> bool

Whether the member is a bot.

Clone, Debug

Full rustdoc page