Skip to content

Commit

Permalink
feat(user): add banner param to ClientUser.edit (nextcord#1171)
Browse files Browse the repository at this point in the history
* feat(user): add `banner` param to ClientUser.edit

* docs(user): give `banner` a description like `avatar`
  • Loading branch information
spifory authored May 21, 2024
1 parent 108e957 commit 570c640
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion nextcord/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ async def edit(
*,
username: str = MISSING,
avatar: Optional[Union[bytes, Asset, Attachment, File]] = MISSING,
banner: Optional[Union[bytes, Asset, Attachment, File]] = MISSING,
) -> ClientUser:
"""|coro|
Expand All @@ -378,20 +379,26 @@ async def edit(
.. versionchanged:: 2.1
The ``avatar`` parameter now accepts :class:`File`, :class:`Attachment`, and :class:`Asset`.
.. versionadded:: 3.0
The ``banner`` field has been added.
Parameters
----------
username: :class:`str`
The new username you wish to change to.
avatar: Optional[Union[:class:`bytes`, :class:`Asset`, :class:`Attachment`, :class:`File`]]
A :term:`py:bytes-like object`, :class:`File`, :class:`Attachment`, or :class:`Asset`
representing the image to upload. Could be ``None`` to denote no avatar.
banner: Optional[Union[:class:`bytes`, :class:`Asset`, :class:`Attachment`, :class:`File`]]
A :term:`py:bytes-like object`, :class:`File`, :class:`Attachment`, or :class:`Asset`
representing the image to upload. Could be ``None`` to denote no banner.
Raises
------
HTTPException
Editing your profile failed.
InvalidArgument
Wrong image format passed for ``avatar``.
Wrong image format passed for ``avatar`` and/or ``banner``.
Returns
-------
Expand All @@ -403,6 +410,8 @@ async def edit(
payload["username"] = username
if avatar is not MISSING:
payload["avatar"] = await obj_to_base64_data(avatar)
if banner is not MISSING:
payload["banner"] = await obj_to_base64_data(banner)

data: UserPayload = await self._state.http.edit_profile(payload)
return ClientUser(state=self._state, data=data)
Expand Down

0 comments on commit 570c640

Please sign in to comment.