mirror of
https://onedev.fprog.nl/DiscordClient
synced 2026-03-31 01:44:08 +02:00
Formatting.
This commit is contained in:
parent
e717332b12
commit
53f34368bd
|
|
@ -9,4 +9,4 @@ public class GuildMessageSearchResponse
|
||||||
|
|
||||||
[JsonPropertyName("messages")]
|
[JsonPropertyName("messages")]
|
||||||
public ChannelMessagesResponse[][] Messages { get; set; }
|
public ChannelMessagesResponse[][] Messages { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class DiscordUserClient
|
||||||
[JsonPropertyName("content")]
|
[JsonPropertyName("content")]
|
||||||
public string Content { get; set; }
|
public string Content { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This method does NOT work yet.
|
/// This method does NOT work yet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -44,7 +44,7 @@ public class DiscordUserClient
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
string url = $"https://discord.com/api/v9/channels/{channelId}/messages";
|
string url = $"https://discord.com/api/v9/channels/{channelId}/messages";
|
||||||
HttpContent httpContent = JsonContent.Create(new MessageContent{Content = message});
|
HttpContent httpContent = JsonContent.Create(new MessageContent { Content = message });
|
||||||
return await _httpClient.PostAsync(url, httpContent);
|
return await _httpClient.PostAsync(url, httpContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,11 +54,13 @@ public class DiscordUserClient
|
||||||
return await _httpClient.DeleteAsync(url);
|
return await _httpClient.DeleteAsync(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GuildMessageSearchResponse?> SearchGuildMessages(string guildId, string? authorId = null)
|
public async Task<GuildMessageSearchResponse?> SearchGuildMessages(
|
||||||
|
string guildId,
|
||||||
|
string? authorId = null
|
||||||
|
)
|
||||||
{
|
{
|
||||||
string authorQuery = authorId is not null ? $"?author_id={authorId}" : "";
|
string authorQuery = authorId is not null ? $"?author_id={authorId}" : "";
|
||||||
string url =
|
string url = $"https://discord.com/api/v9/guilds/{guildId}/messages/search{authorQuery}";
|
||||||
$"https://discord.com/api/v9/guilds/{guildId}/messages/search{authorQuery}";
|
|
||||||
HttpResponseMessage response = await _httpClient.GetAsync(url);
|
HttpResponseMessage response = await _httpClient.GetAsync(url);
|
||||||
return await response.Content.ReadFromJsonAsync<GuildMessageSearchResponse>();
|
return await response.Content.ReadFromJsonAsync<GuildMessageSearchResponse>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue