Browse Source

Only use @ prefix in __str__ if the user is migrated

pull/10109/head
Rapptz 2 years ago
committed by dolfies
parent
commit
13418771d1
  1. 2
      discord/member.py
  2. 2
      discord/team.py
  3. 6
      discord/user.py
  4. 2
      discord/widget.py

2
discord/member.py

@ -243,7 +243,7 @@ class Member(discord.abc.Messageable, discord.abc.Connectable, _UserTag):
.. describe:: str(x) .. describe:: str(x)
Returns the member's name with a ``@``. Returns the member's handle (e.g. ``@user`` or ``user#discriminator``).
Attributes Attributes
---------- ----------

2
discord/team.py

@ -497,7 +497,7 @@ class TeamMember(User):
.. describe:: str(x) .. describe:: str(x)
Returns the team member's name with a ``@``. Returns the team member's handle (e.g. ``@user`` or ``user#discriminator``).
.. versionadded:: 1.3 .. versionadded:: 1.3

6
discord/user.py

@ -277,7 +277,9 @@ class BaseUser(_UserTag):
) )
def __str__(self) -> str: def __str__(self) -> str:
if self.discriminator == '0':
return f'@{self.name}' return f'@{self.name}'
return f'{self.name}#{self.discriminator}'
def __eq__(self, other: object) -> bool: def __eq__(self, other: object) -> bool:
return isinstance(other, _UserTag) and other.id == self.id return isinstance(other, _UserTag) and other.id == self.id
@ -609,7 +611,7 @@ class ClientUser(BaseUser):
.. describe:: str(x) .. describe:: str(x)
Returns the user's name with a ``@``. Returns the user's handle (e.g. ``@user`` or ``user#discriminator``).
.. versionchanged:: 2.0 .. versionchanged:: 2.0
:attr:`Locale` is now a :class:`Locale` instead of a Optional[:class:`str`]. :attr:`Locale` is now a :class:`Locale` instead of a Optional[:class:`str`].
@ -947,7 +949,7 @@ class User(BaseUser, discord.abc.Connectable, discord.abc.Messageable):
.. describe:: str(x) .. describe:: str(x)
Returns the user's name with a ``@``. Returns the user's handle (e.g. ``@user`` or ``user#discriminator``).
Attributes Attributes
----------- -----------

2
discord/widget.py

@ -121,7 +121,7 @@ class WidgetMember(BaseUser):
.. describe:: str(x) .. describe:: str(x)
Returns the widget member's name with a ``@``. Returns the widget member's handle (e.g. ``@user`` or ``user#discriminator``).
Attributes Attributes
----------- -----------

Loading…
Cancel
Save