Make reset command return back to GamesPlayedWhileIdle

This commit is contained in:
Archi
2021-06-23 23:39:21 +02:00
parent b01d25fb28
commit 897e7150e2
2 changed files with 23 additions and 23 deletions

View File

@@ -895,6 +895,27 @@ namespace ArchiSteamFarm.Steam {
}
}
internal async Task CheckOccupationStatus() {
StopPlayingWasBlockedTimer();
if (!IsPlayingPossible) {
PlayingWasBlocked = true;
ArchiLogger.LogGenericInfo(Strings.BotAccountOccupied);
return;
}
if (PlayingWasBlocked && (PlayingWasBlockedTimer == null)) {
InitPlayingWasBlockedTimer();
}
ArchiLogger.LogGenericInfo(Strings.BotAccountFree);
if (!await CardsFarmer.Resume(false).ConfigureAwait(false)) {
await ResetGamesPlayed().ConfigureAwait(false);
}
}
internal bool DeleteRedeemedKeysFiles() {
string unusedKeysFilePath = GetFilePath(EFileType.KeysToRedeemUnused);
@@ -1677,27 +1698,6 @@ namespace ArchiSteamFarm.Steam {
return gamesToRedeemInBackground;
}
private async Task CheckOccupationStatus() {
StopPlayingWasBlockedTimer();
if (!IsPlayingPossible) {
PlayingWasBlocked = true;
ArchiLogger.LogGenericInfo(Strings.BotAccountOccupied);
return;
}
if (PlayingWasBlocked && (PlayingWasBlockedTimer == null)) {
InitPlayingWasBlockedTimer();
}
ArchiLogger.LogGenericInfo(Strings.BotAccountFree);
if (!await CardsFarmer.Resume(false).ConfigureAwait(false)) {
await ResetGamesPlayed().ConfigureAwait(false);
}
}
private async Task Connect(bool force = false) {
if (!force && (!KeepRunning || SteamClient.IsConnected)) {
return;

View File

@@ -2888,9 +2888,9 @@ namespace ArchiSteamFarm.Steam.Interaction {
return FormatBotResponse(Strings.BotNotConnected);
}
(bool success, string message) = await Bot.Actions.Play(Array.Empty<uint>(), Bot.BotConfig.CustomGamePlayedWhileIdle).ConfigureAwait(false);
await Bot.CheckOccupationStatus().ConfigureAwait(false);
return FormatBotResponse(success ? message : string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, message));
return FormatBotResponse(Strings.Done);
}
private static async Task<string?> ResponseReset(ulong steamID, string botNames) {