mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-21 00:07:51 +00:00
Add Guild.chunked property.
This commit is contained in:
parent
20041ea756
commit
d93067ca0f
@ -143,8 +143,7 @@ class Guild(Hashable):
|
||||
return self.name
|
||||
|
||||
def __repr__(self):
|
||||
chunked = getattr(self, '_member_count', None) == len(self._members)
|
||||
return '<Guild id={0.id} name={0.name!r} chunked={1}>'.format(self, chunked)
|
||||
return '<Guild id={0.id} name={0.name!r} chunked={0.chunked}>'.format(self)
|
||||
|
||||
def _update_voice_state(self, data, channel_id):
|
||||
user_id = int(data['user_id'])
|
||||
@ -324,6 +323,21 @@ class Guild(Hashable):
|
||||
"""Returns the true member count regardless of it being loaded fully or not."""
|
||||
return self._member_count
|
||||
|
||||
@property
|
||||
def chunked(self):
|
||||
"""Returns a boolean indicating if the guild is "chunked".
|
||||
|
||||
A chunked guild means that :attr:`member_count` is equal to the
|
||||
number of members stored in the internal :attr:`members` cache.
|
||||
|
||||
If this value returns ``False``, then you should request for
|
||||
offline members.
|
||||
"""
|
||||
count = getattr(self, '_member_count', None)
|
||||
if count is None:
|
||||
return False
|
||||
return count == len(self._members)
|
||||
|
||||
@property
|
||||
def shard_id(self):
|
||||
"""Returns the shard ID for this guild if applicable."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user