diff --git a/DiscordClient/Data/GuildMessageSearchResponse.cs b/DiscordClient/Data/GuildMessageSearchResponse.cs index fbc0873..cae0f94 100644 --- a/DiscordClient/Data/GuildMessageSearchResponse.cs +++ b/DiscordClient/Data/GuildMessageSearchResponse.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; namespace DiscordClient.Data; -public class GuildMessageSearchResponse +public class MessageSearchResponse { [JsonPropertyName("total_results")] public int TotalMessages { get; set; } diff --git a/DiscordClient/DiscordUserClient.cs b/DiscordClient/DiscordUserClient.cs index e9e1373..6f9c33c 100644 --- a/DiscordClient/DiscordUserClient.cs +++ b/DiscordClient/DiscordUserClient.cs @@ -21,14 +21,14 @@ public class DiscordUserClient public async Task<( HttpResponseMessage Response, - ChannelMessagesResponse[]? JsonData + MessageSearchResponse? JsonData )> GetChannelMessages(string channelId, int offset = 0, string? authorId = null, int limit = 50) { string authorQuery = authorId is not null ? $"&author_id={authorId}" : ""; string url = - $"https://discord.com/api/v9/channels/{channelId}/messages?limit={limit}&offset={offset}{authorQuery}"; + $"https://discord.com/api/v9/channels/{channelId}/messages/search?limit={limit}&offset={offset}{authorQuery}"; HttpResponseMessage response = await _httpClient.GetAsync(url); - return (response, await response.Content.ReadFromJsonAsync()); + return (response, await response.Content.ReadFromJsonAsync()); } sealed class MessageContent @@ -68,13 +68,13 @@ public class DiscordUserClient /// public async Task<( HttpResponseMessage Response, - GuildMessageSearchResponse? JsonData + MessageSearchResponse? JsonData )> SearchGuildMessages(string guildId, int offset, string? authorId = null) { 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 (response, await response.Content.ReadFromJsonAsync()); + return (response, await response.Content.ReadFromJsonAsync()); } }