This commit is contained in:
Archi
2023-12-12 00:05:19 +01:00
parent 40ab1d848c
commit d5a41dce1d

View File

@@ -115,6 +115,23 @@ public sealed class Actions : IAsyncDisposable, IDisposable {
return (success, token, success ? Strings.Success : Strings.WarningFailed);
}
[PublicAPI]
public async Task<(bool Success, IReadOnlyCollection<Confirmation>? Confirmations, string Message)> GetConfirmations() {
if (Bot.BotDatabase.MobileAuthenticator == null) {
return (false, null, Strings.BotNoASFAuthenticator);
}
if (!Bot.IsConnectedAndLoggedOn) {
return (false, null, Strings.BotNotConnected);
}
ImmutableHashSet<Confirmation>? confirmations = await Bot.BotDatabase.MobileAuthenticator.GetConfirmations().ConfigureAwait(false);
bool success = confirmations != null;
return (success, confirmations, success ? Strings.Success : Strings.WarningFailed);
}
[PublicAPI]
public ulong GetFirstSteamMasterID() {
ulong steamMasterID = Bot.BotConfig.SteamUserPermissions.Where(kv => (kv.Key > 0) && (kv.Key != Bot.SteamID) && new SteamID(kv.Key).IsIndividualAccount && (kv.Value == BotConfig.EAccess.Master)).Select(static kv => kv.Key).OrderBy(static steamID => steamID).FirstOrDefault();
@@ -135,23 +152,6 @@ public sealed class Actions : IAsyncDisposable, IDisposable {
return new SemaphoreLock(TradingSemaphore);
}
[PublicAPI]
public async Task<(bool Success, IReadOnlyCollection<Confirmation>? Confirmations, string Message)> GetConfirmations() {
if (Bot.BotDatabase.MobileAuthenticator == null) {
return (false, null, Strings.BotNoASFAuthenticator);
}
if (!Bot.IsConnectedAndLoggedOn) {
return (false, null, Strings.BotNotConnected);
}
ImmutableHashSet<Confirmation>? confirmations = await Bot.BotDatabase.MobileAuthenticator.GetConfirmations().ConfigureAwait(false);
bool success = confirmations != null;
return (success, confirmations, success ? Strings.Success : Strings.WarningFailed);
}
[PublicAPI]
public async Task<(bool Success, IReadOnlyCollection<Confirmation>? HandledConfirmations, string Message)> HandleTwoFactorAuthenticationConfirmations(bool accept, Confirmation.EConfirmationType? acceptedType = null, IReadOnlyCollection<ulong>? acceptedCreatorIDs = null, bool waitIfNeeded = false) {
if (Bot.BotDatabase.MobileAuthenticator == null) {