Browse Source

Add option to change global display name (#556)

pull/10109/head
Wyatt 2 years ago
committed by GitHub
parent
commit
f7e5100e5f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      discord/user.py

10
discord/user.py

@ -776,6 +776,7 @@ class ClientUser(BaseUser):
self, self,
*, *,
username: str = MISSING, username: str = MISSING,
global_name: Optional[str] = MISSING,
avatar: Optional[bytes] = MISSING, avatar: Optional[bytes] = MISSING,
avatar_decoration: Optional[bytes] = MISSING, avatar_decoration: Optional[bytes] = MISSING,
password: str = MISSING, password: str = MISSING,
@ -812,7 +813,7 @@ class ClientUser(BaseUser):
----------- -----------
password: :class:`str` password: :class:`str`
The current password for the client's account. The current password for the client's account.
Required for everything except avatar, banner, accent_colour, date_of_birth, and bio. Required for everything except avatar, banner, accent_colour, date_of_birth, global_name, and bio.
new_password: :class:`str` new_password: :class:`str`
The new password you wish to change to. The new password you wish to change to.
email: :class:`str` email: :class:`str`
@ -857,6 +858,10 @@ class ClientUser(BaseUser):
This change cannot be undone and requires you to be in the pomelo rollout. This change cannot be undone and requires you to be in the pomelo rollout.
.. versionadded:: 2.1 .. versionadded:: 2.1
global_name: Optional[:class:`str`]
The new global display name you wish to change to.
.. versionadded:: 2.1
Raises Raises
------ ------
@ -926,6 +931,9 @@ class ClientUser(BaseUser):
if username is not MISSING: if username is not MISSING:
args['username'] = username args['username'] = username
if global_name is not MISSING:
args['global_name'] = global_name
if discriminator is not MISSING: if discriminator is not MISSING:
if self.is_pomelo(): if self.is_pomelo():
raise ValueError('Discriminator cannot be changed when migrated to pomelo') raise ValueError('Discriminator cannot be changed when migrated to pomelo')

Loading…
Cancel
Save