Included offset in SearchGuildMessages.

This commit is contained in:
Filip Strajnar 2024-04-11 20:46:23 +02:00
parent 906df00e59
commit 457fc8a9c5

View file

@ -65,11 +65,13 @@ public class DiscordUserClient
/// <returns></returns>
public async Task<GuildMessageSearchResponse?> SearchGuildMessages(
string guildId,
ulong offset,
string? authorId = null
)
{
string authorQuery = authorId is not null ? $"?author_id={authorId}" : "";
string url = $"https://discord.com/api/v9/guilds/{guildId}/messages/search{authorQuery}";
string authorQuery = authorId is not null ? $"&author_id={authorId}" : "";
string url =
$"https://discord.com/api/v9/guilds/{guildId}/messages/search?offset={offset}{authorQuery}";
HttpResponseMessage response = await _httpClient.GetAsync(url);
return await response.Content.ReadFromJsonAsync<GuildMessageSearchResponse>();
}