App Logo
discord.com

search_messages

Search a Discord server's message history, newest first, using Discord's own search. The query accepts Discord's search syntax (plain words, or filters like from:, in:, has:, before:, during:), so scoping to a channel or author is done in the query itself. Returns per hit: messageId, channelId, url, author (id, handle, name), content, timestamp, plus total_results as Discord reports it and complete, which is false when more hits exist beyond the page read. Discord returns search hits with surrounding context messages; only the hits themselves are returned.

Input

query required

What to search for. Discord's own search syntax works here, e.g. 'deploy', 'from:someone deploy', 'in:general has:link'.

guildId required

Server id to search, e.g. from discord.com/list_servers.

limit optional

How many hits to return, newest first. Discord serves 25 per page and this reads one page, so 25 is the maximum; total_results tells you how many exist.

Default: 25

Output

count required
query required
guildId required
messages required
complete optional

True when every hit Discord reported was returned; false when more exist beyond this page.

total_results optional

Discord's own count of matching messages, which can exceed the number returned.

Start building not clicking