Add support for server-side message filtering
Author: TyrrrzCreated Mar 31, 2026Updated Mar 31, 2026
Labelsenhancement
Discord has added the search API: https://docs.discord.com/developers/resources/message#search-guild-messages
This should let us leverage our existing message filtering support server-side, vastly reducing export times in some cases.
Proposed implementation:
- Keep the existing filtering infrastructure.
- When a message filter is specified, use the new
guild/{id}/messages/searchAPI instead of theguild/{id}/messagesAPI. - Use the parsed filter to extract individual components like
author_id,has,mentions, etc.. - Fill out the rest of the query parameters, such that the usage of the
messages/searchAPI mimics themessagesAPI as closely as possible (e.g. setchannel_idto one specific channel rather than the whole guild). - Get the messages from the API.
- Apply our own filtering on top of it.
- Discord's search feature only supports guild messages, not direct messages.
- Our filtering functionality may support tokens that Discord itself does not support.
- Discord's search API has certain limitations (e.g.
author_idcannot be used more than 100 times), our filtering functionality does not have limitations. - If Discord's search API already successfully filtered the messages, then our own filtering will be a no-op.
- Otherwise, it will act as a fallback layer, ensuring the messages get filtered locally if not server-side.
Source: Tyrrrz/DiscordChatExporter