@@ -398,7 +398,9 @@ def _update(self, data: UserPayload) -> None:
398
398
self ._flags = data .get ('flags' , 0 )
399
399
self .mfa_enabled = data .get ('mfa_enabled' , False )
400
400
401
- async def edit (self , * , username : str = MISSING , avatar : Optional [bytes ] = MISSING ) -> ClientUser :
401
+ async def edit (
402
+ self , * , username : str = MISSING , avatar : Optional [bytes ] = MISSING , banner : Optional [bytes ] = MISSING
403
+ ) -> ClientUser :
402
404
"""|coro|
403
405
404
406
Edits the current profile of the client.
@@ -426,6 +428,12 @@ async def edit(self, *, username: str = MISSING, avatar: Optional[bytes] = MISSI
426
428
A :term:`py:bytes-like object` representing the image to upload.
427
429
Could be ``None`` to denote no avatar.
428
430
Only image formats supported for uploading are JPEG, PNG, GIF, and WEBP.
431
+ banner: Optional[:class:`bytes`]
432
+ A :term:`py:bytes-like object` representing the image to upload.
433
+ Could be ``None`` to denote no banner.
434
+ Only image formats supported for uploading are JPEG, PNG, GIF and WEBP.
435
+
436
+ .. versionadded:: 2.4
429
437
430
438
Raises
431
439
------
@@ -449,6 +457,12 @@ async def edit(self, *, username: str = MISSING, avatar: Optional[bytes] = MISSI
449
457
else :
450
458
payload ['avatar' ] = None
451
459
460
+ if banner is not MISSING :
461
+ if banner is not None :
462
+ payload ['banner' ] = _bytes_to_base64_data (banner )
463
+ else :
464
+ payload ['banner' ] = None
465
+
452
466
data : UserPayload = await self ._state .http .edit_profile (payload )
453
467
return ClientUser (state = self ._state , data = data )
454
468
0 commit comments