mirror of
https://onedev.fprog.nl/DiscordClient
synced 2025-12-29 08:18:36 +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
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly string _myDiscordId;
|
||||
public string MyDiscordId => _myDiscordId;
|
||||
|
||||
public DiscordUserClient(string authorizationToken)
|
||||
{
|
||||
|
|
@ -17,6 +19,10 @@ public class DiscordUserClient
|
|||
"Authorization",
|
||||
authorizationToken
|
||||
);
|
||||
|
||||
_myDiscordId =
|
||||
MyShortProfile().Result?.Id
|
||||
?? throw new InvalidOperationException("Unable to set discord ID of this client.");
|
||||
}
|
||||
|
||||
public async Task<ShortProfile?> GetShortProfile(string userId)
|
||||
|
|
|
|||
Loading…
Reference in a new issue