From 5a9c44afb2dae079d06f516627078491f0b5ae80 Mon Sep 17 00:00:00 2001 From: endercheif Date: Thu, 16 Dec 2021 21:56:03 -0800 Subject: [PATCH] :sparkles: File upload with modify_current_user --- pincer/client.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pincer/client.py b/pincer/client.py index d284843a..85a6102a 100644 --- a/pincer/client.py +++ b/pincer/client.py @@ -34,7 +34,7 @@ Intents, GuildTemplate, Connection, - StickerPack + StickerPack, File ) from .objects.guild.channel import GroupDMChannel from .utils.conversion import construct_client_dict, remove_none @@ -902,7 +902,7 @@ async def get_current_user(self) -> User: ) async def modify_current_user( - self, username: Optional[str] = None, avatar: Optional = None + self, username: Optional[str] = None, avatar: Optional[File] = None ) -> User: """|coro| Modify the requester's user account settings @@ -913,7 +913,7 @@ async def modify_current_user( user's username, if changed may cause the user's discriminator to be randomized. |default| :data:`None` - avatar : Optional[:class:``] + avatar : Optional[:class:`File`] if passed, modifies the user's avatar a data URI scheme of JPG, GIF or PNG |default| :data:`None` @@ -924,6 +924,8 @@ async def modify_current_user( Current modified user """ + avatar = avatar.uri if avatar else avatar + user = await self.http.patch( "users/@me", remove_none({"username": username, "avatar": avatar}) )