mirror of
https://onedev.fprog.nl/DiscordClient
synced 2026-02-13 13:53:42 +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(
|
public async Task<ChannelMessagesResponse[]?> GetChannelMessages(
|
||||||
string channelId,
|
string channelId,
|
||||||
int offset = 0,
|
int offset = 0,
|
||||||
|
string? authorId = null,
|
||||||
int limit = 50
|
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);
|
HttpResponseMessage response = await _httpClient.GetAsync(url);
|
||||||
return await response.Content.ReadFromJsonAsync<ChannelMessagesResponse[]>();
|
return await response.Content.ReadFromJsonAsync<ChannelMessagesResponse[]>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue