From cb8cb557f539baf41640cad3037be02ff9b79818 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 10 Sep 2020 05:56:48 -0400 Subject: Add Guild.chunk and deprecated Client.request_offline_members --- discord/guild.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'discord/guild.py') diff --git a/discord/guild.py b/discord/guild.py index c15b78cf..fcc4e4b3 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -2037,6 +2037,23 @@ class Guild(Hashable): return Widget(state=self._state, data=data) + async def chunk(self, *, cache=True): + """|coro| + + Requests all members that belong to this guild. In order to use this, + :meth:`Intents.members` must be enabled. + + This is a websocket operation and can be slow. + + .. versionadded:: 1.5 + + Parameters + ----------- + cache: :class:`bool` + Whether to cache the members as well. + """ + return await self._state.chunk_guild(self, cache=cache) + async def query_members(self, query=None, *, limit=5, user_ids=None, cache=True): """|coro| @@ -2049,16 +2066,15 @@ class Guild(Hashable): Parameters ----------- - query: :class:`str` - The string that the username's start with. An empty string - requests all members. + query: Optional[:class:`str`] + The string that the username's start with. limit: :class:`int` The maximum number of members to send back. This must be - a number between 1 and 100. + a number between 5 and 100. cache: :class:`bool` Whether to cache the members internally. This makes operations such as :meth:`get_member` work for those that matched. - user_ids: List[:class:`int`] + user_ids: Optional[List[:class:`int`]] List of user IDs to search for. If the user ID is not in the guild then it won't be returned. .. versionadded:: 1.4 -- cgit v1.2.3