pub struct EditProfile { /* private fields */ }
Expand description
A builder to edit the current user’s settings, to be used in conjunction with
CurrentUser::edit
.
Implementations§
Source§impl EditProfile
impl EditProfile
Sourcepub fn new() -> Self
pub fn new() -> Self
Equivalent to Self::default
.
Sourcepub fn avatar(self, avatar: &CreateAttachment) -> Self
pub fn avatar(self, avatar: &CreateAttachment) -> Self
Set the avatar of the current user.
§Examples
let avatar = CreateAttachment::path("./my_image.jpg").await.expect("Failed to read image.");
current_user.edit(http, EditProfile::new().avatar(&avatar)).await?;
Sourcepub fn delete_avatar(self) -> Self
pub fn delete_avatar(self) -> Self
Delete the current user’s avatar, resetting it to the default logo.
Sourcepub fn username(self, username: impl Into<String>) -> Self
pub fn username(self, username: impl Into<String>) -> Self
Modifies the current user’s username.
When modifying the username, if another user has the same new username and current discriminator, a new unique discriminator will be assigned. If there are no available discriminators with the requested username, an error will occur.
Sets the banner of the current user.
Deletes the current user’s banner, resetting it to the default.
Trait Implementations§
Source§impl Builder for EditProfile
impl Builder for EditProfile
Source§fn execute<'life0, 'async_trait>(
self,
cache_http: impl 'async_trait + CacheHttp,
_ctx: Self::Context<'life0>,
) -> Pin<Box<dyn Future<Output = Result<Self::Built>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
self,
cache_http: impl 'async_trait + CacheHttp,
_ctx: Self::Context<'life0>,
) -> Pin<Box<dyn Future<Output = Result<Self::Built>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Edit the current user’s profile with the fields set.
§Errors
Returns an Error::Http
if an invalid value is set. May also return an Error::Json
if there is an error in deserializing the API response.
Source§type Context<'ctx> = ()
type Context<'ctx> = ()
type Built = CurrentUser
Source§impl Clone for EditProfile
impl Clone for EditProfile
Source§fn clone(&self) -> EditProfile
fn clone(&self) -> EditProfile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more