From 37ada59639bd6fb5793cc889303db29afa245c7e Mon Sep 17 00:00:00 2001 From: Quin Lynch <49576606+quinchs@users.noreply.github.com> Date: Sun, 30 Jan 2022 01:54:19 -0400 Subject: [PATCH] Fix attempt to get application info for non-bot tokens (#2071) --- src/Discord.Net.Rest/DiscordRestClient.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.Rest/DiscordRestClient.cs b/src/Discord.Net.Rest/DiscordRestClient.cs index bb976d293..b1948f80a 100644 --- a/src/Discord.Net.Rest/DiscordRestClient.cs +++ b/src/Discord.Net.Rest/DiscordRestClient.cs @@ -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)