Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Commit

Permalink
✨ File upload with modify_current_user
Browse files Browse the repository at this point in the history
  • Loading branch information
Enderchief committed Dec 17, 2021
1 parent 8fc2aa0 commit 5a9c44a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pincer/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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`
Expand All @@ -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})
)
Expand Down

0 comments on commit 5a9c44a

Please sign in to comment.