Fix attempt to get application info for non-bot tokens (#2071)

This commit is contained in:
Quin Lynch
2022-01-30 01:54:19 -04:00
committed by GitHub
parent f52513188f
commit 37ada59639

View File

@@ -59,10 +59,14 @@ namespace Discord.Rest
internal override async Task OnLoginAsync(TokenType tokenType, string token)
{
var user = await ApiClient.GetMyUserAsync(new RequestOptions { RetryMode = RetryMode.AlwaysRetry }).ConfigureAwait(false);
await GetApplicationInfoAsync(new RequestOptions { RetryMode = RetryMode.AlwaysRetry }).ConfigureAwait(false);
ApiClient.CurrentUserId = user.Id;
ApiClient.CurrentApplicationId = _applicationInfo.Id;
base.CurrentUser = RestSelfUser.Create(this, user);
if(tokenType == TokenType.Bot)
{
await GetApplicationInfoAsync(new RequestOptions { RetryMode = RetryMode.AlwaysRetry }).ConfigureAwait(false);
ApiClient.CurrentApplicationId = _applicationInfo.Id;
}
}
internal void CreateRestSelfUser(API.User user)