Move token fetching further below

This commit is contained in:
JustArchi
2019-01-26 22:11:35 +01:00
parent 546cc55ab9
commit 47b2aa137f

View File

@@ -231,14 +231,6 @@ namespace ArchiSteamFarm {
return (false, Strings.BotSendingTradeToYourself);
}
if (string.IsNullOrEmpty(tradeToken) && (Bot.SteamFriends.GetFriendRelationship(targetSteamID) != EFriendRelationship.Friend)) {
Bot targetBot = Bot.Bots.Values.FirstOrDefault(bot => bot.SteamID == targetSteamID);
if (targetBot?.IsConnectedAndLoggedOn == true) {
tradeToken = await targetBot.ArchiHandler.GetTradeToken().ConfigureAwait(false);
}
}
lock (TradingSemaphore) {
if (TradingScheduled) {
return (false, Strings.ErrorAborted);
@@ -264,6 +256,14 @@ namespace ArchiSteamFarm {
return (false, Strings.BotLootingFailed);
}
if (string.IsNullOrEmpty(tradeToken) && (Bot.SteamFriends.GetFriendRelationship(targetSteamID) != EFriendRelationship.Friend)) {
Bot targetBot = Bot.Bots.Values.FirstOrDefault(bot => bot.SteamID == targetSteamID);
if (targetBot?.IsConnectedAndLoggedOn == true) {
tradeToken = await targetBot.ArchiHandler.GetTradeToken().ConfigureAwait(false);
}
}
(bool success, HashSet<ulong> mobileTradeOfferIDs) = await Bot.ArchiWebHandler.SendTradeOffer(targetSteamID, inventory, token: tradeToken).ConfigureAwait(false);
if ((mobileTradeOfferIDs != null) && (mobileTradeOfferIDs.Count > 0) && Bot.HasMobileAuthenticator) {