Skip to content

Commit 37ada59

Browse files
authored
Fix attempt to get application info for non-bot tokens (#2071)
1 parent f525131 commit 37ada59

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Discord.Net.Rest/DiscordRestClient.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ internal override async ValueTask DisposeAsync(bool disposing)
5959
internal override async Task OnLoginAsync(TokenType tokenType, string token)
6060
{
6161
var user = await ApiClient.GetMyUserAsync(new RequestOptions { RetryMode = RetryMode.AlwaysRetry }).ConfigureAwait(false);
62-
await GetApplicationInfoAsync(new RequestOptions { RetryMode = RetryMode.AlwaysRetry }).ConfigureAwait(false);
6362
ApiClient.CurrentUserId = user.Id;
64-
ApiClient.CurrentApplicationId = _applicationInfo.Id;
6563
base.CurrentUser = RestSelfUser.Create(this, user);
64+
65+
if(tokenType == TokenType.Bot)
66+
{
67+
await GetApplicationInfoAsync(new RequestOptions { RetryMode = RetryMode.AlwaysRetry }).ConfigureAwait(false);
68+
ApiClient.CurrentApplicationId = _applicationInfo.Id;
69+
}
6670
}
6771

6872
internal void CreateRestSelfUser(API.User user)

0 commit comments

Comments
 (0)