API reference
Method SearchMessagesAsync
- Namespace
- DisCatSharp.Experimental.Entities
- Assembly
- DisCatSharp.Experimental.dll
SearchMessagesAsync(DiscordGuild, DiscordGuildMessageSearchParams, CancellationToken)
Searches the guild for messages through elasticsearch. If the guild isn't indexed yet, it'll return a 202 accepted response, we're gonna throw at this point. Access the NotIndexedException's RetryAfter field to know when to retry this request.
public static Task<DiscordSearchGuildMessagesResponse?> SearchMessagesAsync(this DiscordGuild guild, DiscordGuildMessageSearchParams searchParams, CancellationToken cancellationToken = default)
Parameters
guildDiscordGuildThe guild.
searchParamsDiscordGuildMessageSearchParamsThe guild messages search params
cancellationTokenCancellationTokenA token to cancel the request.
Returns
Exceptions
- ValidationException
Thrown if the user gave an invalid input.
- NotIndexedException
Thrown if the elasticsearch endpoint has not finished indexing yet.
- UnauthorizedException
Thrown when the client does not have the ManageGuild permission.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.