mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 22:20:52 +00:00
Add !api
This commit is contained in:
@@ -56,14 +56,19 @@ namespace ArchiSteamFarm {
|
||||
private readonly string SentryFile;
|
||||
private readonly BotDatabase BotDatabase;
|
||||
private readonly CallbackManager CallbackManager;
|
||||
|
||||
[JsonProperty]
|
||||
private readonly CardsFarmer CardsFarmer;
|
||||
|
||||
private readonly SteamApps SteamApps;
|
||||
private readonly SteamFriends SteamFriends;
|
||||
private readonly SteamUser SteamUser;
|
||||
private readonly Timer AcceptConfirmationsTimer, SendItemsTimer;
|
||||
private readonly Trading Trading;
|
||||
|
||||
[JsonProperty]
|
||||
internal bool KeepRunning { get; private set; }
|
||||
|
||||
internal bool PlayingBlocked { get; private set; }
|
||||
|
||||
private bool FirstTradeSent, InvalidPassword, SkipFirstShutdown;
|
||||
@@ -354,6 +359,8 @@ namespace ArchiSteamFarm {
|
||||
return await Response2FAConfirm(steamID, false).ConfigureAwait(false);
|
||||
case "!2faok":
|
||||
return await Response2FAConfirm(steamID, true).ConfigureAwait(false);
|
||||
case "!api":
|
||||
return ResponseAPI(steamID);
|
||||
case "!exit":
|
||||
return ResponseExit(steamID);
|
||||
case "!farm":
|
||||
@@ -754,6 +761,24 @@ namespace ArchiSteamFarm {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string ResponseAPI(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
Logging.LogNullError(nameof(steamID));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsOwner(steamID)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return JsonConvert.SerializeObject(Bots);
|
||||
} catch (JsonException e) {
|
||||
Logging.LogGenericException(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static string ResponseExit(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
Logging.LogNullError(nameof(steamID));
|
||||
|
||||
@@ -31,10 +31,14 @@ using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ArchiSteamFarm {
|
||||
internal sealed class CardsFarmer {
|
||||
[JsonProperty]
|
||||
internal readonly ConcurrentDictionary<uint, float> GamesToFarm = new ConcurrentDictionary<uint, float>();
|
||||
|
||||
[JsonProperty]
|
||||
internal readonly ConcurrentHashSet<uint> CurrentGamesFarming = new ConcurrentHashSet<uint>();
|
||||
|
||||
private readonly ManualResetEventSlim FarmResetEvent = new ManualResetEventSlim(false);
|
||||
@@ -42,6 +46,7 @@ namespace ArchiSteamFarm {
|
||||
private readonly Bot Bot;
|
||||
private readonly Timer Timer;
|
||||
|
||||
[JsonProperty]
|
||||
internal bool ManualMode { get; private set; }
|
||||
|
||||
private bool KeepFarming, NowFarming;
|
||||
|
||||
Reference in New Issue
Block a user