Browse Source

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

tags/3.2.1
Quin Lynch GitHub 3 years ago
parent
commit
37ada59639
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      src/Discord.Net.Rest/DiscordRestClient.cs

+ 6
- 2
src/Discord.Net.Rest/DiscordRestClient.cs 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)


Loading…
Cancel
Save