diff --git a/ArchiSteamFarm/ArchiSteamFarm.csproj b/ArchiSteamFarm/ArchiSteamFarm.csproj index 60835faec5073..8ee1f151fe6c4 100644 --- a/ArchiSteamFarm/ArchiSteamFarm.csproj +++ b/ArchiSteamFarm/ArchiSteamFarm.csproj @@ -120,6 +120,12 @@ + + PreserveNewest + + + PreserveNewest + @@ -143,9 +149,7 @@ SteamAuth - - - + diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 981d6967f3f32..952c9477a70d1 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -428,11 +428,6 @@ private async Task ResponseSendTrade() { return "Trade couldn't be send because SteamMasterID is not defined!"; } - string token = null; - if (!string.IsNullOrEmpty(BotConfig.SteamTradeToken) && !BotConfig.SteamTradeToken.Equals("null")) { - token = BotConfig.SteamTradeToken; - } - await Trading.LimitInventoryRequestsAsync().ConfigureAwait(false); List inventory = await ArchiWebHandler.GetMyTradableInventory().ConfigureAwait(false); @@ -440,7 +435,7 @@ private async Task ResponseSendTrade() { return "Nothing to send, inventory seems empty!"; } - if (await ArchiWebHandler.SendTradeOffer(inventory, BotConfig.SteamMasterID, token).ConfigureAwait(false)) { + if (await ArchiWebHandler.SendTradeOffer(inventory, BotConfig.SteamMasterID, BotConfig.SteamTradeToken).ConfigureAwait(false)) { await AcceptAllConfirmations().ConfigureAwait(false); return "Trade offer sent successfully!"; } else { diff --git a/ArchiSteamFarm/BotConfig.cs b/ArchiSteamFarm/BotConfig.cs index 0f37439d6cc82..815a31198bcd8 100644 --- a/ArchiSteamFarm/BotConfig.cs +++ b/ArchiSteamFarm/BotConfig.cs @@ -80,7 +80,7 @@ internal sealed class BotConfig { [JsonProperty(Required = Required.DisallowNull)] internal bool SendOnFarmingFinished { get; private set; } = false; - [JsonProperty(Required = Required.DisallowNull)] + [JsonProperty] internal string SteamTradeToken { get; private set; } = null; [JsonProperty(Required = Required.DisallowNull)] @@ -230,6 +230,10 @@ internal static BotConfig LoadOldFormat(string path) { botConfig.SteamParentalPIN = null; } + if (botConfig.SteamTradeToken != null && botConfig.SteamTradeToken.Equals("null")) { + botConfig.SteamTradeToken = null; + } + return botConfig; } diff --git a/ArchiSteamFarm/config/example.json b/ArchiSteamFarm/config/example.json index dd8ff62fa13d0..559e5428093bd 100644 --- a/ArchiSteamFarm/config/example.json +++ b/ArchiSteamFarm/config/example.json @@ -15,7 +15,7 @@ "UseAsfAsMobileAuthenticator": false, "ShutdownOnFarmingFinished": false, "SendOnFarmingFinished": false, - "SteamTradeToken": "null", + "SteamTradeToken": null, "SendTradePeriod": 0, "GamesPlayedWhileIdle": [ 0