From ac7c3411f6cf201442ef549d200f9350ba52ea47 Mon Sep 17 00:00:00 2001 From: UK <41271523+NeloBlivion@users.noreply.github.com> Date: Sun, 24 Mar 2024 21:00:51 +0000 Subject: [PATCH 01/11] feat: add once kwarg to Cog.listener (#2403) * add once kwarg to Cog.listener * clarify * style(pre-commit): auto fixes from pre-commit.com hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Lala Sabathil --- discord/cog.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/discord/cog.py b/discord/cog.py index 24a5b58e70..4f064edb26 100644 --- a/discord/cog.py +++ b/discord/cog.py @@ -379,7 +379,9 @@ def _get_overridden_method(cls, method: FuncT) -> FuncT | None: ) @classmethod - def listener(cls, name: str = MISSING) -> Callable[[FuncT], FuncT]: + def listener( + cls, name: str = MISSING, once: bool = False + ) -> Callable[[FuncT], FuncT]: """A decorator that marks a function as a listener. This is the cog equivalent of :meth:`.Bot.listen`. @@ -389,6 +391,9 @@ def listener(cls, name: str = MISSING) -> Callable[[FuncT], FuncT]: name: :class:`str` The name of the event being listened to. If not provided, it defaults to the function's name. + once: :class:`bool` + If this listener should only be called once after each cog load. + Defaults to false. Raises ------ @@ -411,6 +416,7 @@ def decorator(func: FuncT) -> FuncT: raise TypeError("Listener function must be a coroutine function.") actual.__cog_listener__ = True to_assign = name or actual.__name__ + actual._once = once try: actual.__cog_listener_names__.append(to_assign) except AttributeError: From fbd9d7e036de7051b1dbb743d271f8da659db61b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 26 Mar 2024 11:52:41 +0100 Subject: [PATCH 02/11] chore(pre-commit): pre-commit autoupdate (#2410) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.15.1 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.15.1...v3.15.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 81e9a64c72..8838c9a079 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: # - --remove-duplicate-keys # - --remove-unused-variables - repo: https://github.com/asottile/pyupgrade - rev: v3.15.1 + rev: v3.15.2 hooks: - id: pyupgrade args: [--py38-plus] From 8cec636e10dfe2c6aa09156a9a5626f796b54a4d Mon Sep 17 00:00:00 2001 From: UK <41271523+NeloBlivion@users.noreply.github.com> Date: Sat, 30 Mar 2024 06:51:20 +0000 Subject: [PATCH 03/11] fix: pass proper state to interaction._guild (#2411) --- CHANGELOG.md | 2 ++ discord/interactions.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbf54d9c22..8d22818f1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2400](https://github.com/Pycord-Development/pycord/pull/2400)) - Fixed `ScheduledEvent.subscribers` behavior with `limit=None`. ([#2407](https://github.com/Pycord-Development/pycord/pull/2407)) +- Fixed invalid data being passed to `Interaction._guild` in certain cases. + ([#2411](https://github.com/Pycord-Development/pycord/pull/2411)) ### Changed diff --git a/discord/interactions.py b/discord/interactions.py index a4222ca5d6..1362acfac4 100644 --- a/discord/interactions.py +++ b/discord/interactions.py @@ -198,7 +198,7 @@ def _from_data(self, data: InteractionPayload): self._guild: Guild | None = None self._guild_data = data.get("guild") if self.guild is None and self._guild_data: - self._guild = Guild(data=self._guild_data, state=self) + self._guild = Guild(data=self._guild_data, state=self._state) # TODO: there's a potential data loss here if self.guild_id: From bb61cf7cff5531d93a1b1b94670907e1bb54363b Mon Sep 17 00:00:00 2001 From: UK <41271523+NeloBlivion@users.noreply.github.com> Date: Tue, 9 Apr 2024 09:09:12 +0100 Subject: [PATCH 04/11] fix: option and BridgeOption adjustments (#2417) --- CHANGELOG.md | 8 ++++++++ discord/commands/options.py | 15 ++++++++------- discord/ext/bridge/core.py | 38 ++++++++++++++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d22818f1d..940069b33a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2396](https://github.com/Pycord-Development/pycord/pull/2396)) - Added `user` argument to `Paginator.edit`. ([#2390](https://github.com/Pycord-Development/pycord/pull/2390)) +- Added `bridge_option` decorator. Required for `bridge.Bot` in 2.7. + ([#2417](https://github.com/Pycord-Development/pycord/pull/2417)) ### Fixed @@ -34,6 +36,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2407](https://github.com/Pycord-Development/pycord/pull/2407)) - Fixed invalid data being passed to `Interaction._guild` in certain cases. ([#2411](https://github.com/Pycord-Development/pycord/pull/2411)) +- Fixed option typehints being ignored when using `parameter_name`. + ([#2417](https://github.com/Pycord-Development/pycord/pull/2417)) ### Changed @@ -41,6 +45,10 @@ These changes are available on the `master` branch, but have not yet been releas ([#2387](https://github.com/Pycord-Development/pycord/pull/2387)) - HTTP requests that fail with a 503 status are now re-tried. ([#2395](https://github.com/Pycord-Development/pycord/pull/2395)) +- `option` decorator now accepts `input_type`. + ([#2417](https://github.com/Pycord-Development/pycord/pull/2417)) +- `Option` may be used instead of `BridgeOption` until 2.7. + ([#2417](https://github.com/Pycord-Development/pycord/pull/2417)) ## [2.5.0] - 2024-03-02 diff --git a/discord/commands/options.py b/discord/commands/options.py index 80d525c65b..38cac6b539 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -395,7 +395,7 @@ def to_dict(self) -> dict[str, str | int | float]: return as_dict -def option(name, type=None, **kwargs): +def option(name, input_type=None, **kwargs): """A decorator that can be used instead of typehinting :class:`.Option`. .. versionadded:: 2.0 @@ -408,12 +408,13 @@ def option(name, type=None, **kwargs): """ def decorator(func): - nonlocal type - type = type or func.__annotations__.get(name, str) - if parameter := kwargs.get("parameter_name"): - func.__annotations__[parameter] = Option(type, name=name, **kwargs) - else: - func.__annotations__[name] = Option(type, **kwargs) + resolved_name = kwargs.pop("parameter_name", None) or name + itype = ( + kwargs.pop("type", None) + or input_type + or func.__annotations__.get(resolved_name, str) + ) + func.__annotations__[resolved_name] = Option(itype, name=name, **kwargs) return func return decorator diff --git a/discord/ext/bridge/core.py b/discord/ext/bridge/core.py index b1a37b3980..c14d9db95a 100644 --- a/discord/ext/bridge/core.py +++ b/discord/ext/bridge/core.py @@ -40,7 +40,7 @@ SlashCommandOptionType, ) -from ...utils import MISSING, find, get +from ...utils import MISSING, find, get, warn_deprecated from ..commands import BadArgument from ..commands import Bot as ExtBot from ..commands import ( @@ -63,6 +63,7 @@ "BridgeCommandGroup", "bridge_command", "bridge_group", + "bridge_option", "BridgeExtCommand", "BridgeSlashCommand", "BridgeExtGroup", @@ -627,3 +628,38 @@ async def convert(self, ctx, argument: str) -> Any: return converted except ValueError as exc: raise BadArgument() from exc + + +def bridge_option(name, input_type=None, **kwargs): + """A decorator that can be used instead of typehinting :class:`.BridgeOption`. + + .. versionadded:: 2.6 + + Attributes + ---------- + parameter_name: :class:`str` + The name of the target parameter this option is mapped to. + This allows you to have a separate UI ``name`` and parameter name. + """ + + def decorator(func): + resolved_name = kwargs.pop("parameter_name", None) or name + itype = ( + kwargs.pop("type", None) + or input_type + or func.__annotations__.get(resolved_name, str) + ) + func.__annotations__[resolved_name] = BridgeOption(itype, name=name, **kwargs) + return func + + return decorator + + +discord.commands.options.Option = BridgeOption +discord.Option = BridgeOption +warn_deprecated( + "Option", + "BridgeOption", + "2.5", + reference="https://github.com/Pycord-Development/pycord/pull/2417", +) From 59b9b32b7d6044158c45e3d9b4c4ad346618f443 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 08:14:16 +0000 Subject: [PATCH 05/11] chore(pre-commit): pre-commit autoupdate (#2416) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8838c9a079..7ca67dc12b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer From 90d27c56f93a12dc20005edec90a4f2dece6c905 Mon Sep 17 00:00:00 2001 From: UK <41271523+NeloBlivion@users.noreply.github.com> Date: Fri, 12 Apr 2024 06:43:32 +0100 Subject: [PATCH 06/11] feat: implement Guild.search_members (#2418) * implement guild member search * clarification. * style(pre-commit): auto fixes from pre-commit.com hooks * cl * undo iteration * style(pre-commit): auto fixes from pre-commit.com hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- CHANGELOG.md | 2 ++ discord/guild.py | 30 ++++++++++++++++++++++++++++++ discord/http.py | 14 ++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 940069b33a..0ae1911b88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2390](https://github.com/Pycord-Development/pycord/pull/2390)) - Added `bridge_option` decorator. Required for `bridge.Bot` in 2.7. ([#2417](https://github.com/Pycord-Development/pycord/pull/2417)) +- Added `Guild.search_members`. + ([#2418](https://github.com/Pycord-Development/pycord/pull/2418)) ### Fixed diff --git a/discord/guild.py b/discord/guild.py index d1044cf3f8..2b6ff7a382 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -2027,6 +2027,36 @@ def fetch_members( return MemberIterator(self, limit=limit, after=after) + async def search_members(self, query: str, *, limit: int = 1000) -> list[Member]: + """Search for guild members whose usernames or nicknames start with the query string. Unlike :meth:`fetch_members`, this does not require :meth:`Intents.members`. + + .. note:: + + This method is an API call. For general usage, consider filtering :attr:`members` instead. + + .. versionadded:: 2.6 + + Parameters + ---------- + query: :class:`str` + Searches for usernames and nicknames that start with this string, case-insensitive. + limit: Optional[:class:`int`] + The maximum number of members to retrieve, up to 1000. + + Returns + ------- + List[:class:`Member`] + The list of members that have matched the query. + + Raises + ------ + HTTPException + Getting the members failed. + """ + + data = await self._state.http.search_members(self.id, query, limit) + return [Member(data=m, guild=self, state=self._state) for m in data] + async def fetch_member(self, member_id: int, /) -> Member: """|coro| diff --git a/discord/http.py b/discord/http.py index a8833d17af..e79d6120b7 100644 --- a/discord/http.py +++ b/discord/http.py @@ -1636,6 +1636,20 @@ def get_members( r = Route("GET", "/guilds/{guild_id}/members", guild_id=guild_id) return self.request(r, params=params) + def search_members( + self, + guild_id: Snowflake, + query: str, + limit: int, + ) -> Response[list[member.MemberWithUser]]: + params: dict[str, Any] = { + "query": query, + "limit": limit, + } + + r = Route("GET", "/guilds/{guild_id}/members/search", guild_id=guild_id) + return self.request(r, params=params) + def get_member( self, guild_id: Snowflake, member_id: Snowflake ) -> Response[member.MemberWithUser]: From 2df4ac95deb3546bb1ab4adb328046c6d95e08f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 15:31:56 +0000 Subject: [PATCH 07/11] ci(deps): bump ribtoks/tdg-github-action from 0.4.7.pre.beta to 0.4.10.pre.beta (#2420) ci(deps): bump ribtoks/tdg-github-action Bumps [ribtoks/tdg-github-action](https://github.com/ribtoks/tdg-github-action) from 0.4.7.pre.beta to 0.4.10.pre.beta. - [Release notes](https://github.com/ribtoks/tdg-github-action/releases) - [Commits](https://github.com/ribtoks/tdg-github-action/compare/v0.4.7-beta...v0.4.10-beta) --- updated-dependencies: - dependency-name: ribtoks/tdg-github-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: plun1331 --- .github/workflows/todo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/todo.yml b/.github/workflows/todo.yml index 508f34218f..6f4ba8a5b6 100644 --- a/.github/workflows/todo.yml +++ b/.github/workflows/todo.yml @@ -6,7 +6,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run tdg-github-action - uses: ribtoks/tdg-github-action@v0.4.7-beta + uses: ribtoks/tdg-github-action@v0.4.10-beta with: TOKEN: ${{ secrets.GITHUB_TOKEN }} REPO: ${{ github.repository }} From c10022cc7be5cd4bcbbacc9b68f4053c01064a09 Mon Sep 17 00:00:00 2001 From: jordan-day <47164307+jordan-day@users.noreply.github.com> Date: Mon, 15 Apr 2024 04:09:52 -0700 Subject: [PATCH 08/11] fix: Added member data to the raw_reaction_remove event (#2412) * fix: Added member data to the raw_reaction_remove event * style(pre-commit): auto fixes from pre-commit.com hooks * Added changelog.md for adding member data to raw reaction remove * Update CHANGELOG.md Signed-off-by: plun1331 * doc: Updated documentation for the RawReactionActionEvent.member field --------- Signed-off-by: plun1331 Co-authored-by: root Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: plun1331 --- CHANGELOG.md | 2 ++ discord/raw_models.py | 3 +-- discord/state.py | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ae1911b88..2bdd10e65d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2417](https://github.com/Pycord-Development/pycord/pull/2417)) - Added `Guild.search_members`. ([#2418](https://github.com/Pycord-Development/pycord/pull/2418)) +- Added `member` data to the `raw_reaction_remove` event. + ([#2412](https://github.com/Pycord-Development/pycord/pull/2412)) ### Fixed diff --git a/discord/raw_models.py b/discord/raw_models.py index 49f5575064..e3d38e558d 100644 --- a/discord/raw_models.py +++ b/discord/raw_models.py @@ -205,8 +205,7 @@ class RawReactionActionEvent(_RawReprMixin): emoji: :class:`PartialEmoji` The custom or unicode emoji being used. member: Optional[:class:`Member`] - The member who added the reaction. Only available if `event_type` is `REACTION_ADD` - and the reaction is inside a guild. + The member who added the reaction. Only available if the reaction occurs within a guild. .. versionadded:: 1.3 diff --git a/discord/state.py b/discord/state.py index 5b9aea0e35..0f9a6dc438 100644 --- a/discord/state.py +++ b/discord/state.py @@ -783,6 +783,17 @@ def parse_message_reaction_remove(self, data) -> None: emoji_id = utils._get_as_snowflake(emoji, "id") emoji = PartialEmoji.with_state(self, id=emoji_id, name=emoji["name"]) raw = RawReactionActionEvent(data, emoji, "REACTION_REMOVE") + + member_data = data.get("member") + if member_data: + guild = self._get_guild(raw.guild_id) + if guild is not None: + raw.member = Member(data=member_data, guild=guild, state=self) + else: + raw.member = None + else: + raw.member = None + self.dispatch("raw_reaction_remove", raw) message = self._get_message(raw.message_id) From 7a7f3649cf6920edb8a6ca39505ea1c16e6f16c1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 16 Apr 2024 02:14:35 +0000 Subject: [PATCH 09/11] chore(pre-commit): pre-commit autoupdate (#2422) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 24.3.0 → 24.4.0](https://github.com/psf/black/compare/24.3.0...24.4.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7ca67dc12b..9719862ee2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: hooks: - id: isort - repo: https://github.com/psf/black - rev: 24.3.0 + rev: 24.4.0 hooks: - id: black args: [--safe, --quiet] From 929e15ef71752a8ca4ce2daa55ad6022e5aa1365 Mon Sep 17 00:00:00 2001 From: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Date: Tue, 16 Apr 2024 14:10:58 +0300 Subject: [PATCH 10/11] docs: remove false optional (#2424) docs: not optional --- discord/guild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/guild.py b/discord/guild.py index 2b6ff7a382..6632743105 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -2040,7 +2040,7 @@ async def search_members(self, query: str, *, limit: int = 1000) -> list[Member] ---------- query: :class:`str` Searches for usernames and nicknames that start with this string, case-insensitive. - limit: Optional[:class:`int`] + limit: :class:`int` The maximum number of members to retrieve, up to 1000. Returns From f5683c5f56b1c1692b010ff9f775fd536d0c9cab Mon Sep 17 00:00:00 2001 From: UK <41271523+NeloBlivion@users.noreply.github.com> Date: Tue, 16 Apr 2024 21:01:15 +0100 Subject: [PATCH 11/11] fix: Guild.query_members may accept empty query and limit (#2419) Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Co-authored-by: plun1331 --- CHANGELOG.md | 2 ++ discord/guild.py | 35 ++++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bdd10e65d..9c6e30c8a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2417](https://github.com/Pycord-Development/pycord/pull/2417)) - `Option` may be used instead of `BridgeOption` until 2.7. ([#2417](https://github.com/Pycord-Development/pycord/pull/2417)) +- `Guild.query_members` now accepts `limit=None` to retrieve all members. + ([#2419](https://github.com/Pycord-Development/pycord/pull/2419)) ## [2.5.0] - 2024-03-02 diff --git a/discord/guild.py b/discord/guild.py index 6632743105..d94eb2df83 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -3361,7 +3361,7 @@ async def query_members( self, query: str | None = None, *, - limit: int = 5, + limit: int | None = 5, user_ids: list[int] | None = None, presences: bool = False, cache: bool = True, @@ -3379,10 +3379,14 @@ async def query_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 5 and 100. - presences: :class:`bool` + 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 + limit: Optional[:class:`int`] + The maximum number of members to send back. If no query is passed, passing ``None`` returns all members. + If a ``query`` or ``user_ids`` is passed, must be between 1 and 100. Defaults to 5. + presences: Optional[:class:`bool`] Whether to request for presences to be provided. This defaults to ``False``. @@ -3390,11 +3394,7 @@ async def query_members( cache: :class:`bool` Whether to cache the members internally. This makes operations - such as :meth:`get_member` work for those that matched. - 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 + such as :meth:`get_member` work for those that matched. Defaults to ``True``. Returns ------- @@ -3414,12 +3414,18 @@ async def query_members( if presences and not self._state._intents.presences: raise ClientException("Intents.presences must be enabled to use this.") - if query is None: - if query == "": - raise ValueError("Cannot pass empty query string.") + if not limit or limit > 100 or limit < 1: + if query or user_ids: + raise ValueError( + "limit must be between 1 and 100 when using query or user_ids" + ) + if not limit: + query = "" + limit = 0 + if query is None: if user_ids is None: - raise ValueError("Must pass either query or user_ids") + raise ValueError("Must pass query or user_ids, or set limit to None") if user_ids is not None and query is not None: raise ValueError("Cannot pass both query and user_ids") @@ -3427,7 +3433,6 @@ async def query_members( if user_ids is not None and not user_ids: raise ValueError("user_ids must contain at least 1 value") - limit = min(100, limit or 5) return await self._state.query_members( self, query=query,