#[non_exhaustive]pub struct Member {Show 14 fields
pub user: User,
pub nick: Option<CompactString>,
pub avatar: Option<ImageHash>,
pub banner: Option<ImageHash>,
pub roles: Vec<RoleId>,
pub joined_at: Option<Timestamp>,
pub premium_since: Option<Timestamp>,
pub deaf: bool,
pub mute: bool,
pub flags: MemberFlags,
pub pending: bool,
pub communication_disabled_until: Option<Timestamp>,
pub avatar_decoration_data: Option<Box<AvatarDecorationData>>,
pub collectibles: Option<Box<Collectibles>>,
}Expand description
A guild member: a user’s membership in one guild, with guild-specific data such as nickname and roles.
This is the complete shape (it includes the user), as returned by
GET /guilds/{guild.id}/members/{user.id} and member gateway events. Messages carry a
PartialMember instead (D-051).
discord.js counterpart: GuildMember.
§Examples
use djs_model::guild::Member;
let member: Member = serde_json::from_str(r#"{
"user": {"id": "80351110224678912", "username": "nelly", "discriminator": "0",
"global_name": "Nelly", "avatar": null},
"nick": "NOT API SUPPORT", "roles": [], "joined_at": "2015-04-26T06:26:56.936000+00:00",
"deaf": false, "mute": false, "flags": 0
}"#)?;
assert_eq!(member.display_name(), "NOT API SUPPORT");Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.user: UserThe user this membership belongs to.
nick: Option<CompactString>The member’s nickname in this guild.
avatar: Option<ImageHash>The member’s guild avatar hash, overriding the user’s avatar in this guild.
The member’s guild banner hash.
roles: Vec<RoleId>The IDs of the member’s roles (the @everyone role is implied and not listed).
joined_at: Option<Timestamp>When the user joined the guild. None for guest members.
When the user started boosting the guild.
deaf: boolWhether the member is deafened in voice channels.
mute: boolWhether the member is muted in voice channels.
flags: MemberFlagsThe member’s flags.
pending: boolWhether the member has not yet passed the guild’s membership screening. Such members cannot use most of the guild until they do.
communication_disabled_until: Option<Timestamp>When the member’s timeout ends. A time in the past means the member is no longer timed out.
avatar_decoration_data: Option<Box<AvatarDecorationData>>The member’s guild-specific avatar decoration.
collectibles: Option<Box<Collectibles>>The member’s guild-specific collectibles.
Implementations§
Source§impl Member
impl Member
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
Returns the name shown for the member in this guild: the nickname, else the user’s display name, else the username.
discord.js counterpart: GuildMember#displayName.
Sourcepub fn is_timed_out(&self, now: Timestamp) -> bool
pub fn is_timed_out(&self, now: Timestamp) -> bool
Returns whether the member is timed out at now.
discord.js counterpart: GuildMember#isCommunicationDisabled.