Improve resilency against DuplicateRequest

This commit is contained in:
Archi
2023-04-02 22:24:31 +02:00
parent b8ba995db0
commit 142d1bdd28
2 changed files with 3 additions and 2 deletions

View File

@@ -149,6 +149,7 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
public SteamFriends SteamFriends { get; }
internal bool CanReceiveSteamCards => !IsAccountLimited && !IsAccountLocked;
internal bool HasLoginCodeReady => !string.IsNullOrEmpty(TwoFactorCode) || !string.IsNullOrEmpty(AuthCode);
private readonly CallbackManager CallbackManager;
private readonly SemaphoreSlim CallbackSemaphore = new(1, 1);
@@ -2038,7 +2039,7 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
break;
case EResult.AccountLoginDeniedNeedTwoFactor:
case EResult.DuplicateRequest: // Not sure about this one, it seems to be just generic "try again"?
case EResult.DuplicateRequest: // This will happen if user reacts to popup and tries to use the code afterwards, we have the code saved in ASF, we just need to try again
case EResult.InvalidPassword:
case EResult.NoConnection:
case EResult.PasswordRequiredToKickSession: // Not sure about this one, it seems to be just generic "try again"? #694

View File

@@ -48,7 +48,7 @@ internal sealed class BotCredentialsProvider : IAuthenticator {
}
public async Task<bool> AcceptDeviceConfirmationAsync() {
if (Bot.HasMobileAuthenticator) {
if (Bot.HasMobileAuthenticator || Bot.HasLoginCodeReady) {
// We don't want device confirmation under any circumstance, we can provide the code on our own
return false;
}