|
|
@ -450,9 +450,7 @@ class Guild(Hashable): |
|
|
|
def _from_data(self, guild: GuildPayload) -> None: |
|
|
|
# according to Stan, this is always available even if the guild is unavailable |
|
|
|
# I don't have this guarantee when someone updates the guild. |
|
|
|
member_count = guild.get('member_count', None) |
|
|
|
if member_count is not None: |
|
|
|
self._member_count: int = member_count |
|
|
|
self._member_count: Optional[int] = guild.get('member_count', None) |
|
|
|
|
|
|
|
self.name: str = guild.get('name', '') |
|
|
|
self.verification_level: VerificationLevel = try_enum(VerificationLevel, guild.get('verification_level')) |
|
|
@ -514,7 +512,7 @@ class Guild(Hashable): |
|
|
|
self._add_member(member) |
|
|
|
|
|
|
|
self._sync(guild) |
|
|
|
self._large: Optional[bool] = None if member_count is None else self._member_count >= 250 |
|
|
|
self._large: Optional[bool] = None if self._member_count is None else self._member_count >= 250 |
|
|
|
|
|
|
|
self.owner_id: Optional[int] = utils._get_as_snowflake(guild, 'owner_id') |
|
|
|
self.afk_channel: Optional[VocalGuildChannel] = self.get_channel(utils._get_as_snowflake(guild, 'afk_channel_id')) # type: ignore |
|
|
@ -966,14 +964,17 @@ class Guild(Hashable): |
|
|
|
return Asset._from_guild_image(self._state, self.id, self._discovery_splash, path='discovery-splashes') |
|
|
|
|
|
|
|
@property |
|
|
|
def member_count(self) -> int: |
|
|
|
""":class:`int`: Returns the true member count regardless of it being loaded fully or not. |
|
|
|
def member_count(self) -> Optional[int]: |
|
|
|
"""Optional[:class:`int`]: Returns the member count if available. |
|
|
|
|
|
|
|
.. warning:: |
|
|
|
|
|
|
|
Due to a Discord limitation, in order for this attribute to remain up-to-date and |
|
|
|
accurate, it requires :attr:`Intents.members` to be specified. |
|
|
|
|
|
|
|
.. versionchanged:: 2.0 |
|
|
|
|
|
|
|
Now returns an ``Optional[int]``. |
|
|
|
""" |
|
|
|
return self._member_count |
|
|
|
|
|
|
|