mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a1914540c | ||
|
|
449e4f9511 | ||
|
|
959bf98039 |
@@ -261,8 +261,8 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
if ((acceptedSteamID != 0) || ((acceptedTradeIDs != null) && (acceptedTradeIDs.Count > 0))) {
|
||||
List<Task<Steam.ConfirmationDetails>> detailsTasks = confirmations.Select(BotDatabase.MobileAuthenticator.GetConfirmationDetails).ToList();
|
||||
Steam.ConfirmationDetails[] detailsResults = await Task.WhenAll(detailsTasks).ConfigureAwait(false);
|
||||
List<Task<Steam.ConfirmationDetails>> tasks = confirmations.Select(BotDatabase.MobileAuthenticator.GetConfirmationDetails).ToList();
|
||||
Steam.ConfirmationDetails[] detailsResults = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
|
||||
HashSet<uint> ignoredConfirmationIDs = new HashSet<uint>();
|
||||
foreach (Steam.ConfirmationDetails details in detailsResults.Where(details => (details != null) && (
|
||||
@@ -282,8 +282,11 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
List<Task<bool>> tasks = confirmations.Select(confirmation => BotDatabase.MobileAuthenticator.HandleConfirmation(confirmation, accept)).ToList();
|
||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
// This could be done in parallel, but for some reason Steam allows only one confirmation being accepted at the time
|
||||
// Therefore, even though no physical barrier stops us from doing so, we execute this synchronously
|
||||
foreach (MobileAuthenticator.Confirmation confirmation in confirmations) {
|
||||
await BotDatabase.MobileAuthenticator.HandleConfirmation(confirmation, accept).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
internal async Task<bool> RefreshSession() {
|
||||
@@ -360,9 +363,11 @@ namespace ArchiSteamFarm {
|
||||
case "!loot":
|
||||
return await ResponseSendTrade(steamID).ConfigureAwait(false);
|
||||
case "!pause":
|
||||
return await ResponsePause(steamID).ConfigureAwait(false);
|
||||
return await ResponsePause(steamID, true).ConfigureAwait(false);
|
||||
case "!rejoinchat":
|
||||
return ResponseRejoinChat(steamID);
|
||||
case "!resume":
|
||||
return await ResponsePause(steamID, false).ConfigureAwait(false);
|
||||
case "!restart":
|
||||
return ResponseRestart(steamID);
|
||||
case "!status":
|
||||
@@ -405,7 +410,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
return await ResponseOwns(steamID, BotName, args[1]).ConfigureAwait(false);
|
||||
case "!pause":
|
||||
return await ResponsePause(steamID, args[1]).ConfigureAwait(false);
|
||||
return await ResponsePause(steamID, args[1], true).ConfigureAwait(false);
|
||||
case "!play":
|
||||
if (args.Length > 2) {
|
||||
return await ResponsePlay(steamID, args[1], args[2]).ConfigureAwait(false);
|
||||
@@ -418,6 +423,8 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
return await ResponseRedeem(steamID, BotName, args[1], false).ConfigureAwait(false);
|
||||
case "!resume":
|
||||
return await ResponsePause(steamID, args[1], false).ConfigureAwait(false);
|
||||
case "!start":
|
||||
return await ResponseStart(steamID, args[1]).ConfigureAwait(false);
|
||||
case "!status":
|
||||
@@ -500,7 +507,7 @@ namespace ArchiSteamFarm {
|
||||
Logging.LogGenericInfo("Successfully finished importing mobile authenticator!", BotName);
|
||||
}
|
||||
|
||||
private async Task<string> ResponsePause(ulong steamID) {
|
||||
private async Task<string> ResponsePause(ulong steamID, bool pause) {
|
||||
if (steamID == 0) {
|
||||
Logging.LogNullError(nameof(steamID), BotName);
|
||||
return null;
|
||||
@@ -510,16 +517,24 @@ namespace ArchiSteamFarm {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (CardsFarmer.ManualMode) {
|
||||
await CardsFarmer.SwitchToManualMode(false).ConfigureAwait(false);
|
||||
return "Automatic farming is enabled again!";
|
||||
if (pause) {
|
||||
if (CardsFarmer.ManualMode) {
|
||||
return "Automatic farming is stopped already!";
|
||||
}
|
||||
|
||||
await CardsFarmer.SwitchToManualMode(true).ConfigureAwait(false);
|
||||
return "Automatic farming is now stopped!";
|
||||
}
|
||||
|
||||
await CardsFarmer.SwitchToManualMode(true).ConfigureAwait(false);
|
||||
return "Automatic farming is now stopped!";
|
||||
if (!CardsFarmer.ManualMode) {
|
||||
return "Automatic farming is enabled already!";
|
||||
}
|
||||
|
||||
await CardsFarmer.SwitchToManualMode(false).ConfigureAwait(false);
|
||||
return "Automatic farming is now enabled!";
|
||||
}
|
||||
|
||||
private static async Task<string> ResponsePause(ulong steamID, string botName) {
|
||||
private static async Task<string> ResponsePause(ulong steamID, string botName, bool pause) {
|
||||
if ((steamID == 0) || string.IsNullOrEmpty(botName)) {
|
||||
Logging.LogNullError(nameof(steamID) + " || " + nameof(botName));
|
||||
return null;
|
||||
@@ -527,7 +542,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
Bot bot;
|
||||
if (Bots.TryGetValue(botName, out bot)) {
|
||||
return await bot.ResponsePause(steamID).ConfigureAwait(false);
|
||||
return await bot.ResponsePause(steamID, pause).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (IsOwner(steamID)) {
|
||||
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.1.0.5")]
|
||||
[assembly: AssemblyFileVersion("2.1.0.5")]
|
||||
[assembly: AssemblyVersion("2.1.0.6")]
|
||||
[assembly: AssemblyFileVersion("2.1.0.6")]
|
||||
|
||||
Reference in New Issue
Block a user