1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
use crate::Snowflake; #[derive(Clone, Debug, Default, Deserialize, Serialize)] /// Represents a User on Discord. pub struct User { /// The Snowflake ID of this user. pub id: Snowflake, /// The username of this user. pub username: String, /// The four-digit number following the user's username. pub discriminator: String, /// The user's avatar hash, if they have one. pub avatar: Option<String>, /// Whether or not this user is a bot. #[serde(default)] pub bot: bool, /// Whether or not this user has two factor authentication on their account. #[serde(default)] pub mfa_enabled: bool, /// The user's email. Only available on user accounts. #[serde(default)] pub email: Option<String> } impl ToString for User { fn to_string(&self) -> String { format!("<@{}>", self.id.0) } }