mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-16 18:59:09 +00:00
Only use @ prefix in __str__ if the user is migrated
This commit is contained in:
parent
b8310268b0
commit
9ebc13e160
@ -274,7 +274,7 @@ class Member(discord.abc.Messageable, _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
|
||||||
----------
|
----------
|
||||||
|
@ -108,7 +108,7 @@ class TeamMember(BaseUser):
|
|||||||
|
|
||||||
.. 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
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ class TeamMember(BaseUser):
|
|||||||
discriminator: :class:`str`
|
discriminator: :class:`str`
|
||||||
The team member's discriminator. This is a legacy concept that is no longer used.
|
The team member's discriminator. This is a legacy concept that is no longer used.
|
||||||
global_name: Optional[:class:`str`]
|
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
|
.. versionadded:: 2.3
|
||||||
bot: :class:`bool`
|
bot: :class:`bool`
|
||||||
|
@ -99,7 +99,9 @@ class BaseUser(_UserTag):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self) -> str:
|
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:
|
def __eq__(self, other: object) -> bool:
|
||||||
return isinstance(other, _UserTag) and other.id == self.id
|
return isinstance(other, _UserTag) and other.id == self.id
|
||||||
@ -317,7 +319,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``).
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
-----------
|
-----------
|
||||||
@ -457,7 +459,7 @@ class User(BaseUser, 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
|
||||||
-----------
|
-----------
|
||||||
|
@ -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…
x
Reference in New Issue
Block a user