mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 06:20:34 +00:00
First set of fixes
This commit is contained in:
@@ -35,6 +35,7 @@ using HtmlAgilityPack;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SteamKit2;
|
||||
using Formatting = Newtonsoft.Json.Formatting;
|
||||
|
||||
namespace ArchiSteamFarm {
|
||||
internal sealed class ArchiWebHandler : IDisposable {
|
||||
@@ -847,7 +848,7 @@ namespace ArchiSteamFarm {
|
||||
{ "partner", partnerID.ToString() },
|
||||
{ "tradeoffermessage", "Sent by ASF" },
|
||||
{ "json_tradeoffer", JsonConvert.SerializeObject(trade) },
|
||||
{ "trade_offer_create_params", string.IsNullOrEmpty(token) ? "" : new JObject { { "trade_offer_access_token", token } }.ToString(Newtonsoft.Json.Formatting.None) }
|
||||
{ "trade_offer_create_params", string.IsNullOrEmpty(token) ? "" : new JObject { { "trade_offer_access_token", token } }.ToString(Formatting.None) }
|
||||
})) {
|
||||
if (!await WebBrowser.UrlPostRetry(request, data, referer).ConfigureAwait(false)) {
|
||||
return false;
|
||||
|
||||
@@ -56,12 +56,13 @@ namespace ArchiSteamFarm {
|
||||
internal readonly ArchiWebHandler ArchiWebHandler;
|
||||
internal readonly string BotName;
|
||||
|
||||
internal bool HasMobileAuthenticator => BotDatabase.MobileAuthenticator != null;
|
||||
internal bool IsConnectedAndLoggedOn => SteamClient.IsConnected && (SteamClient.SteamID != null);
|
||||
internal bool HasMobileAuthenticator => BotDatabase?.MobileAuthenticator != null;
|
||||
internal bool HasValidApiKey => !string.IsNullOrEmpty(BotConfig?.SteamApiKey) && (BotConfig.SteamApiKey.Length == 32);
|
||||
internal bool IsConnectedAndLoggedOn => (SteamClient?.IsConnected == true) && (SteamClient.SteamID != null);
|
||||
internal bool IsPlayingPossible => !PlayingBlocked && (LibraryLockedBySteamID == 0);
|
||||
|
||||
[JsonProperty]
|
||||
internal ulong SteamID => SteamClient.SteamID ?? 0;
|
||||
internal ulong SteamID => SteamClient?.SteamID ?? 0;
|
||||
|
||||
private readonly BotDatabase BotDatabase;
|
||||
private readonly CallbackManager CallbackManager;
|
||||
@@ -1713,7 +1714,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
Dictionary<uint, string> ownedGames;
|
||||
if (!string.IsNullOrEmpty(BotConfig.SteamApiKey)) {
|
||||
if (HasValidApiKey) {
|
||||
ownedGames = ArchiWebHandler.GetOwnedGames(SteamClient.SteamID);
|
||||
} else {
|
||||
ownedGames = await ArchiWebHandler.GetOwnedGames().ConfigureAwait(false);
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace ArchiSteamFarm {
|
||||
const string request = SharedInfo.StatisticsServer + "/api/LoggedOn";
|
||||
Dictionary<string, string> data = new Dictionary<string, string>(4) {
|
||||
{ "SteamID", Bot.SteamID.ToString() },
|
||||
{ "HasMobileAuthenticator", Bot.HasMobileAuthenticator ? "1" : "0" },
|
||||
{ "HasAutomatedTrading", Bot.HasMobileAuthenticator && Bot.HasValidApiKey ? "1" : "0" },
|
||||
{ "SteamTradeMatcher", Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.SteamTradeMatcher) ? "1" : "0" },
|
||||
{ "MatchEverything", Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.MatchEverything) ? "1" : "0" }
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace ArchiSteamFarm {
|
||||
internal void OnDisconnected() => IgnoredTrades.ClearAndTrim();
|
||||
|
||||
private async Task ParseActiveTrades() {
|
||||
if (string.IsNullOrEmpty(Bot.BotConfig.SteamApiKey)) {
|
||||
if (!Bot.HasValidApiKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user