From 5049f82dadbaab577c4870d22a1e0756b76551fa Mon Sep 17 00:00:00 2001 From: Archi Date: Tue, 17 Jan 2023 19:00:31 +0100 Subject: [PATCH] Don't stop matching on occassional two factor failure --- .../RemoteCommunication.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs index 4cd63c488..de1cd062f 100644 --- a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs +++ b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs @@ -655,6 +655,8 @@ internal sealed class RemoteCommunication : IAsyncDisposable, IDisposable { return; } + bool hasWorkingAuthenticator = false; + byte maxTradeHoldDuration = ASF.GlobalConfig?.MaxTradeHoldDuration ?? GlobalConfig.DefaultMaxTradeHoldDuration; uint matchedSets = 0; @@ -833,17 +835,26 @@ internal sealed class RemoteCommunication : IAsyncDisposable, IDisposable { (bool success, HashSet? mobileTradeOfferIDs) = await Bot.ArchiWebHandler.SendTradeOffer(listedUser.SteamID, itemsToGive, itemsToReceive, listedUser.TradeToken, true).ConfigureAwait(false); - if ((mobileTradeOfferIDs?.Count > 0) && Bot.HasMobileAuthenticator) { + if (mobileTradeOfferIDs?.Count > 0) { (bool twoFactorSuccess, _, _) = await Bot.Actions.HandleTwoFactorAuthenticationConfirmations(true, Confirmation.EType.Trade, mobileTradeOfferIDs, true).ConfigureAwait(false); if (!twoFactorSuccess) { Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, nameof(twoFactorSuccess))); + if (hasWorkingAuthenticator) { + // We can assume this to be just a temporary Steam issue, and we may try to continue the matching with other users + break; + } + + // User didn't confirm even one single trade, naturally this could be just a coincidence, but it's more likely that his ASF 2FA credentials are invalid and this is why we'll refuse to continue for now return; } + + hasWorkingAuthenticator = true; } if (!success) { + // The user likely no longer has the items we need, this is fine, we can continue the matching with other ones Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Localization.Strings.TradeOfferFailed, listedUser.SteamID, listedUser.Nickname)); break;