Struct serenity::model::CurrentUser
[−]
[src]
pub struct CurrentUser { pub id: UserId, pub avatar: Option<String>, pub bot: bool, pub discriminator: u16, pub email: Option<String>, pub mfa_enabled: bool, pub mobile: Option<bool>, pub name: String, pub verified: bool, }
Information about the current user.
Fields
id: UserId
avatar: Option<String>
bot: bool
discriminator: u16
email: Option<String>
mfa_enabled: bool
mobile: Option<bool>
Whether the current user has logged in on mobile before.
name: String
verified: bool
Methods
impl CurrentUser
[src]
fn avatar_url(&self) -> Option<String>
Returns the formatted URL of the user's icon, if one exists.
This will produce a WEBP image URL, or GIF if the user has a GIF avatar.
fn distinct(&self) -> String
Returns the DiscordTag of a User.
fn edit<F>(&mut self, f: F) -> Result<()> where F: FnOnce(EditProfile) -> EditProfile
Edits the current user's profile settings.
This mutates the current user in-place.
Refer to EditProfile
's documentation for its methods.
Examples
Change the avatar:
use serenity::client::CACHE; let avatar = serenity::utils::read_image("./avatar.png").unwrap(); CACHE.write().unwrap().user.edit(|p| p.avatar(Some(&avatar)));
fn guilds(&self) -> Result<Vec<GuildInfo>>
Gets a list of guilds that the current user is in.
fn static_avatar_url(&self) -> Option<String>
Returns a static formatted URL of the user's icon, if one exists.
This will always produce a WEBP image URL.
Trait Implementations
impl Clone for CurrentUser
[src]
fn clone(&self) -> CurrentUser
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more