Added SearchGuidMessages method.

This commit is contained in:
Filip Strajnar 2024-03-24 16:47:24 +01:00
parent 0c164698ef
commit e717332b12

View file

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