feat(guild): support message search endpoint - #1522
Open
shiftinv wants to merge 30 commits into
Open
Conversation
…max offset Some result pages can have fewer (or even zero) results, so just continue paginating until we either hit the max offset of 9975, or the total number of available results
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
discord/discord-api-docs@62a0276
This implements
/guilds/{}/messages/search, which allows searching for messages in a guild or specific channels with 24(!) different query parameters. Makes this PR look quite a bit more complex than it really is c:One thing of note is the non-standard pagination with a separate
offsetinstead of the usualbefore/after, as well as some special casing that's unfortunately required since the search indexer works in mysterious ways and can sometimes just return empty result pages (due to deleted messages/channels? would be my guess. anyway.).Additionally, there are situations where we receive a
202 Acceptedwhile the guild is still being indexed, in which case the code automatically retries a configurable number of times after the given delay. So far I've only really seen this in guilds where search had never been used before.Checklist
uv run nox -s lintuv run nox -s pyright