Browse Source

Only use @ prefix in __str__ if the user is migrated

pull/9422/head
Rapptz 2 years ago
parent
commit
9ebc13e160
  1. 2
      discord/member.py
  2. 4
      discord/team.py
  3. 8
      discord/user.py
  4. 2
      discord/widget.py

2
discord/member.py

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

4
discord/team.py

@ -108,7 +108,7 @@ class TeamMember(BaseUser):
.. 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
@ -121,7 +121,7 @@ class TeamMember(BaseUser):
discriminator: :class:`str`
The team member's discriminator. This is a legacy concept that is no longer used.
global_name: Optional[:class:`str`]
The user's global nickname, taking precedence over the username in display.
The team member's global nickname, taking precedence over the username in display.
.. versionadded:: 2.3
bot: :class:`bool`

8
discord/user.py

@ -99,7 +99,9 @@ class BaseUser(_UserTag):
)
def __str__(self) -> str:
return f'@{self.name}'
if self.discriminator == '0':
return f'@{self.name}'
return f'{self.name}#{self.discriminator}'
def __eq__(self, other: object) -> bool:
return isinstance(other, _UserTag) and other.id == self.id
@ -317,7 +319,7 @@ class ClientUser(BaseUser):
.. describe:: str(x)
Returns the user's name with a ``@``.
Returns the user's handle (e.g. ``@user`` or ``user#discriminator``).
Attributes
-----------
@ -457,7 +459,7 @@ class User(BaseUser, discord.abc.Messageable):
.. describe:: str(x)
Returns the user's name with a ``@``.
Returns the user's handle (e.g. ``@user`` or ``user#discriminator``).
Attributes
-----------

2
discord/widget.py

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

Loading…
Cancel
Save