mirror of
https://onedev.fprog.nl/DiscordClient
synced 2025-12-29 08:18:36 +01:00
Added option to search by author's ID.
This commit is contained in:
parent
d1504ed4e8
commit
02b5619d15
|
|
@ -21,10 +21,13 @@ public class DiscordUserClient
|
|||
public async Task<ChannelMessagesResponse[]?> GetChannelMessages(
|
||||
string channelId,
|
||||
int offset = 0,
|
||||
string? authorId = null,
|
||||
int limit = 50
|
||||
)
|
||||
{
|
||||
string url = $"https://discord.com/api/v9/channels/{channelId}/messages?limit={limit}&offset={offset}";
|
||||
string authorQuery = authorId is not null ? $"&author_id={authorId}" : "";
|
||||
string url =
|
||||
$"https://discord.com/api/v9/channels/{channelId}/messages?limit={limit}&offset={offset}{authorQuery}";
|
||||
HttpResponseMessage response = await _httpClient.GetAsync(url);
|
||||
return await response.Content.ReadFromJsonAsync<ChannelMessagesResponse[]>();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue