pub struct User {Show 23 fields
pub id: String,
pub username: String,
pub discriminator: String,
pub global_name: Option<String>,
pub avatar: Option<String>,
pub bot: bool,
pub system: bool,
pub mfa_enabled: bool,
pub banner: Option<String>,
pub accent_color: Option<u32>,
pub locale: Option<String>,
pub verified: Option<bool>,
pub email: Option<String>,
pub phone: Option<String>,
pub desktop: bool,
pub mobile: bool,
pub flags: Option<u64>,
pub premium_type: Option<u8>,
pub public_flags: Option<u64>,
pub avatar_decoration: Option<AvatarDecoration>,
pub collectibles: Option<Nameplate>,
pub primary_guild: Option<PrimaryGuild>,
pub presence: Option<Presence>,
}Fields§
§id: StringUser unique ID
username: StringUsername
discriminator: StringDiscriminator (deprecated)
global_name: Option<String>User’s display name (if any)
avatar: Option<String>§bot: boolWhether the user is a bot
system: boolWhether the user is a system user (e.g., official Discord accounts)
mfa_enabled: boolUser’s banner hash (if any)
accent_color: Option<u32>User’s accent color (if any)
locale: Option<String>User’s locale (e.g., “en-US”)
verified: Option<bool>Whether the user has verified their email (only for the current user)
email: Option<String>Email (only for the current user, requires “email” scope)
phone: Option<String>Phone number (only for the current user, requires “phone” scope)
desktop: boolWhether the use has used the desktop client before
mobile: boolWhether the user has used the mobile client before
flags: Option<u64>Flags (bitfield representing user features)
Premium type (0 = none, 1 = Nitro Classic, 2 = Nitro)
public_flags: Option<u64>Public flags (bitfield representing public user features)
avatar_decoration: Option<AvatarDecoration>Avatar decoration data (if any)
collectibles: Option<Nameplate>Data for the user’s collectibles (if any)
primary_guild: Option<PrimaryGuild>The user’s primary guild
presence: Option<Presence>Live presence data when available from gateway events.
Implementations§
Source§impl User
impl User
Sourcepub fn avatar_url(&self) -> Option<String>
pub fn avatar_url(&self) -> Option<String>
Returns the URL of the user’s avatar (if any)
Returns the URL of the user’s banner (if any)
Sourcepub fn mention(&self) -> String
pub fn mention(&self) -> String
Returns a string representation of the user’s mention (e.g., “<@123456789>”)
Returns a human-readable name for the user’s Nitro subscription (if any)
Sourcepub async fn add_friend(&self, http: &HttpClient) -> Result<()>
pub async fn add_friend(&self, http: &HttpClient) -> Result<()>
Sends a friend request to this user.
Sourcepub async fn block(&self, http: &HttpClient) -> Result<()>
pub async fn block(&self, http: &HttpClient) -> Result<()>
Blocks this user.
Sourcepub async fn remove_relationship(&self, http: &HttpClient) -> Result<()>
pub async fn remove_relationship(&self, http: &HttpClient) -> Result<()>
Removes any relationship with this user (friend, blocked, pending…).