Improve readability

This commit is contained in:
JustArchi
2016-03-14 18:24:03 +01:00
parent de4fbf8b04
commit c189b398c0
2 changed files with 7 additions and 6 deletions

View File

@@ -223,7 +223,7 @@ namespace ArchiSteamFarm {
if (BotConfig.AcceptConfirmationsPeriod > 0 && AcceptConfirmationsTimer == null) {
AcceptConfirmationsTimer = new Timer(
async e => await AcceptConfirmations(true).ConfigureAwait(false),
async e => await AcceptConfirmations().ConfigureAwait(false),
null,
TimeSpan.FromMinutes(BotConfig.AcceptConfirmationsPeriod), // Delay
TimeSpan.FromMinutes(BotConfig.AcceptConfirmationsPeriod) // Period
@@ -247,7 +247,7 @@ namespace ArchiSteamFarm {
Start().Wait();
}
internal async Task AcceptConfirmations(bool all) {
internal async Task AcceptConfirmations(Confirmation.ConfirmationType allowedConfirmationType = Confirmation.ConfirmationType.Unknown) {
if (BotDatabase.SteamGuardAccount == null) {
return;
}
@@ -263,7 +263,7 @@ namespace ArchiSteamFarm {
}
foreach (Confirmation confirmation in confirmations) {
if (confirmation.ConfType != Confirmation.ConfirmationType.Trade && !all) {
if (allowedConfirmationType != Confirmation.ConfirmationType.Unknown && confirmation.ConfType != allowedConfirmationType) {
continue;
}
@@ -537,7 +537,7 @@ namespace ArchiSteamFarm {
}
if (await ArchiWebHandler.SendTradeOffer(inventory, BotConfig.SteamMasterID, BotConfig.SteamTradeToken).ConfigureAwait(false)) {
await AcceptConfirmations(false).ConfigureAwait(false);
await AcceptConfirmations(Confirmation.ConfirmationType.Trade).ConfigureAwait(false);
return "Trade offer sent successfully!";
} else {
return "Trade offer failed due to error!";
@@ -609,7 +609,7 @@ namespace ArchiSteamFarm {
return "That bot doesn't have ASF 2FA enabled!";
}
await AcceptConfirmations(true).ConfigureAwait(false);
await AcceptConfirmations().ConfigureAwait(false);
return "Done!";
}

View File

@@ -22,6 +22,7 @@
*/
using SteamAuth;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@@ -81,7 +82,7 @@ namespace ArchiSteamFarm {
}
await Task.WhenAll(tasks).ConfigureAwait(false);
await Bot.AcceptConfirmations(false).ConfigureAwait(false);
await Bot.AcceptConfirmations(Confirmation.ConfirmationType.Trade).ConfigureAwait(false);
}
private async Task ParseTrade(Steam.TradeOffer tradeOffer) {