mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-14 09:50:03 +00:00
Add support for ClientUser editing banners
This commit is contained in:
parent
edf7ce2ab0
commit
82d13e7b49
@ -398,7 +398,9 @@ class ClientUser(BaseUser):
|
||||
self._flags = data.get('flags', 0)
|
||||
self.mfa_enabled = data.get('mfa_enabled', False)
|
||||
|
||||
async def edit(self, *, username: str = MISSING, avatar: Optional[bytes] = MISSING) -> ClientUser:
|
||||
async def edit(
|
||||
self, *, username: str = MISSING, avatar: Optional[bytes] = MISSING, banner: Optional[bytes] = MISSING
|
||||
) -> ClientUser:
|
||||
"""|coro|
|
||||
|
||||
Edits the current profile of the client.
|
||||
@ -426,6 +428,12 @@ class ClientUser(BaseUser):
|
||||
A :term:`py:bytes-like object` representing the image to upload.
|
||||
Could be ``None`` to denote no avatar.
|
||||
Only image formats supported for uploading are JPEG, PNG, GIF, and WEBP.
|
||||
banner: Optional[:class:`bytes`]
|
||||
A :term:`py:bytes-like object` representing the image to upload.
|
||||
Could be ``None`` to denote no banner.
|
||||
Only image formats supported for uploading are JPEG, PNG, GIF and WEBP.
|
||||
|
||||
.. versionadded:: 2.4
|
||||
|
||||
Raises
|
||||
------
|
||||
@ -449,6 +457,12 @@ class ClientUser(BaseUser):
|
||||
else:
|
||||
payload['avatar'] = None
|
||||
|
||||
if banner is not MISSING:
|
||||
if banner is not None:
|
||||
payload['banner'] = _bytes_to_base64_data(banner)
|
||||
else:
|
||||
payload['banner'] = None
|
||||
|
||||
data: UserPayload = await self._state.http.edit_profile(payload)
|
||||
return ClientUser(state=self._state, data=data)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user