mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 22:20:52 +00:00
Open TradingLock and API key check for public
This commit is contained in:
@@ -79,6 +79,14 @@ namespace ArchiSteamFarm {
|
||||
return (true, token, Strings.Success);
|
||||
}
|
||||
|
||||
[ItemNotNull]
|
||||
[PublicAPI]
|
||||
public async Task<IDisposable> GetTradingLock() {
|
||||
await TradingSemaphore.WaitAsync().ConfigureAwait(false);
|
||||
|
||||
return new SemaphoreLock(TradingSemaphore);
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public async Task<(bool Success, string Message)> HandleTwoFactorAuthenticationConfirmations(bool accept, Steam.ConfirmationDetails.EType? acceptedType = null, IReadOnlyCollection<ulong> acceptedTradeOfferIDs = null, bool waitIfNeeded = false) {
|
||||
if (!Bot.HasMobileAuthenticator) {
|
||||
@@ -413,13 +421,6 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
[ItemNotNull]
|
||||
internal async Task<SemaphoreLock> GetTradingLock() {
|
||||
await TradingSemaphore.WaitAsync().ConfigureAwait(false);
|
||||
|
||||
return new SemaphoreLock(TradingSemaphore);
|
||||
}
|
||||
|
||||
internal void OnDisconnected() => HandledGifts.Clear();
|
||||
|
||||
private ulong GetFirstSteamMasterID() => Bot.BotConfig.SteamUserPermissions.Where(kv => (kv.Key != 0) && (kv.Value == BotConfig.EPermission.Master)).Select(kv => kv.Key).OrderByDescending(steamID => steamID != Bot.SteamID).ThenBy(steamID => steamID).FirstOrDefault();
|
||||
|
||||
@@ -354,6 +354,13 @@ namespace ArchiSteamFarm {
|
||||
return result;
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public async Task<bool?> HasValidApiKey() {
|
||||
(bool success, string steamApiKey) = await CachedApiKey.GetValue().ConfigureAwait(false);
|
||||
|
||||
return success ? !string.IsNullOrEmpty(steamApiKey) : (bool?) null;
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public async Task<(bool Success, HashSet<ulong> MobileTradeOfferIDs)> SendTradeOffer(ulong steamID, IReadOnlyCollection<Steam.Asset> itemsToGive = null, IReadOnlyCollection<Steam.Asset> itemsToReceive = null, string token = null, bool forcedSingleOffer = false) {
|
||||
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount || (((itemsToGive == null) || (itemsToGive.Count == 0)) && ((itemsToReceive == null) || (itemsToReceive.Count == 0)))) {
|
||||
@@ -2000,12 +2007,6 @@ namespace ArchiSteamFarm {
|
||||
return success ? hasPublicInventory : (bool?) null;
|
||||
}
|
||||
|
||||
internal async Task<bool?> HasValidApiKey() {
|
||||
(bool success, string steamApiKey) = await CachedApiKey.GetValue().ConfigureAwait(false);
|
||||
|
||||
return success ? !string.IsNullOrEmpty(steamApiKey) : (bool?) null;
|
||||
}
|
||||
|
||||
internal async Task<bool> Init(ulong steamID, EUniverse universe, string webAPIUserNonce, string parentalCode = null) {
|
||||
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount || (universe == EUniverse.Invalid) || !Enum.IsDefined(typeof(EUniverse), universe) || string.IsNullOrEmpty(webAPIUserNonce)) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(universe) + " || " + nameof(webAPIUserNonce));
|
||||
|
||||
Reference in New Issue
Block a user