aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/guild.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/discord/guild.py b/discord/guild.py
index 2255c297..841e5167 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -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'])
@@ -325,6 +324,21 @@ class Guild(Hashable):
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."""
count = self._state.shard_count