-
-
Notifications
You must be signed in to change notification settings - Fork 743
Description
GetActiveThreadsAsync() is extremely slow in guilds with a lot of active threads due to how it fetches all threads in a guild and filters locally. This is the only officially documented way (to my knowledge) so is an understandable approach, however there are 2 route missing from Discord's main API documentation that would provide a significant performance boost.
Alternative: /channels/{channelId}/threads/active
Seems to behave the same as the current /guilds/{guildId}/threads/active, but only returns threads under the given parent channel. In my testing this provided a very significant performance boost (~10sec down to ~1sec to fetch threads for an active forum)
Bonus: /channels/{channelId}/threads/search
This one is documented in the API spec, just not the written documentation. It offers additional filtering such as min/max snowflake id, tags, limits etc which would be extremely useful to have available for large servers.
Relevant part of the spec: https://github.com/discord/discord-api-spec/blob/c020f56f103767169d22e12d60f57c810ab98a8a/specs/openapi.json#L3348