|
@ -34,6 +34,7 @@ from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Tuple, Typ |
|
|
import discord.abc |
|
|
import discord.abc |
|
|
|
|
|
|
|
|
from . import utils |
|
|
from . import utils |
|
|
|
|
|
from .asset import Asset |
|
|
from .utils import MISSING |
|
|
from .utils import MISSING |
|
|
from .user import BaseUser, User, _UserTag |
|
|
from .user import BaseUser, User, _UserTag |
|
|
from .activity import create_activity, ActivityTypes |
|
|
from .activity import create_activity, ActivityTypes |
|
@ -263,6 +264,7 @@ class Member(discord.abc.Messageable, _UserTag): |
|
|
'_client_status', |
|
|
'_client_status', |
|
|
'_user', |
|
|
'_user', |
|
|
'_state', |
|
|
'_state', |
|
|
|
|
|
'_avatar', |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
if TYPE_CHECKING: |
|
|
if TYPE_CHECKING: |
|
@ -293,6 +295,7 @@ class Member(discord.abc.Messageable, _UserTag): |
|
|
self.activities: Tuple[ActivityTypes, ...] = tuple() |
|
|
self.activities: Tuple[ActivityTypes, ...] = tuple() |
|
|
self.nick: Optional[str] = data.get('nick', None) |
|
|
self.nick: Optional[str] = data.get('nick', None) |
|
|
self.pending: bool = data.get('pending', False) |
|
|
self.pending: bool = data.get('pending', False) |
|
|
|
|
|
self._avatar: Optional[str] = data.get("avatar", None) |
|
|
|
|
|
|
|
|
def __str__(self) -> str: |
|
|
def __str__(self) -> str: |
|
|
return str(self._user) |
|
|
return str(self._user) |
|
@ -498,6 +501,29 @@ class Member(discord.abc.Messageable, _UserTag): |
|
|
""" |
|
|
""" |
|
|
return self.nick or self.name |
|
|
return self.nick or self.name |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
|
def display_avatar(self) -> Asset: |
|
|
|
|
|
""":class:`Asset`: Returns the member's display avatar. |
|
|
|
|
|
|
|
|
|
|
|
For regular members this is just their avatar, but |
|
|
|
|
|
if they have a guild specific avatar then that |
|
|
|
|
|
is returned instead. |
|
|
|
|
|
|
|
|
|
|
|
.. versionadded:: 2.0 |
|
|
|
|
|
""" |
|
|
|
|
|
return self.guild_avatar or self.avatar |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
|
def guild_avatar(self) -> Optional[Asset]: |
|
|
|
|
|
"""Optional[:class:`Asset`:] Returns an :class:`Asset` for the guild avatar |
|
|
|
|
|
the member has if available. |
|
|
|
|
|
|
|
|
|
|
|
.. versionadded:: 2.0 |
|
|
|
|
|
""" |
|
|
|
|
|
if self._avatar is None: |
|
|
|
|
|
return None |
|
|
|
|
|
return Asset._from_guild_avatar(self._state, self.guild.id, self.id, self._avatar) |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def activity(self) -> Optional[ActivityTypes]: |
|
|
def activity(self) -> Optional[ActivityTypes]: |
|
|
"""Optional[Union[:class:`BaseActivity`, :class:`Spotify`]]: Returns the primary |
|
|
"""Optional[Union[:class:`BaseActivity`, :class:`Spotify`]]: Returns the primary |
|
|