Browse Source
Fix guild.chunk() not working on evicted guilds
If you're trying to chunk a guild that the bot is not in,
it'll just hang on the chunk coro forever. It's weird, I know.
pull/6732/head
Steve C
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
1 deletions
-
discord/guild.py
-
discord/state.py
|
|
@ -2218,7 +2218,8 @@ class Guild(Hashable): |
|
|
|
if not self._state._intents.members: |
|
|
|
raise ClientException('Intents.members must be enabled to use this.') |
|
|
|
|
|
|
|
return await self._state.chunk_guild(self, cache=cache) |
|
|
|
if not self._state.is_guild_evicted(self): |
|
|
|
return await self._state.chunk_guild(self, cache=cache) |
|
|
|
|
|
|
|
async def query_members(self, query=None, *, limit=5, user_ids=None, presences=False, cache=True): |
|
|
|
"""|coro| |
|
|
|
|
|
@ -768,6 +768,9 @@ class ConnectionState: |
|
|
|
|
|
|
|
return self._add_guild_from_data(data) |
|
|
|
|
|
|
|
def is_guild_evicted(self, guild) -> bool: |
|
|
|
return guild.id not in self._guilds |
|
|
|
|
|
|
|
async def chunk_guild(self, guild, *, wait=True, cache=None): |
|
|
|
cache = cache or self.member_cache_flags.joined |
|
|
|
request = self._chunk_requests.get(guild.id) |
|
|
|