mirror of
https://onedev.fprog.nl/DiscordClient
synced 2026-02-12 21:23:41 +01:00
Throw an exception if discord ID can't be set.
This commit is contained in:
parent
55a94e7cb3
commit
183c002bda
|
|
@ -8,6 +8,8 @@ namespace DiscordClient;
|
||||||
public class DiscordUserClient
|
public class DiscordUserClient
|
||||||
{
|
{
|
||||||
private readonly HttpClient _httpClient;
|
private readonly HttpClient _httpClient;
|
||||||
|
private readonly string _myDiscordId;
|
||||||
|
public string MyDiscordId => _myDiscordId;
|
||||||
|
|
||||||
public DiscordUserClient(string authorizationToken)
|
public DiscordUserClient(string authorizationToken)
|
||||||
{
|
{
|
||||||
|
|
@ -17,6 +19,10 @@ public class DiscordUserClient
|
||||||
"Authorization",
|
"Authorization",
|
||||||
authorizationToken
|
authorizationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_myDiscordId =
|
||||||
|
MyShortProfile().Result?.Id
|
||||||
|
?? throw new InvalidOperationException("Unable to set discord ID of this client.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ShortProfile?> GetShortProfile(string userId)
|
public async Task<ShortProfile?> GetShortProfile(string userId)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue