Add !startall

This commit is contained in:
JustArchi 2016-09-30 05:32:14 +02:00
parent 7683b98180
commit f7e31a5754

View file

@ -447,6 +447,8 @@ namespace ArchiSteamFarm {
return await ResponsePause(steamID, false).ConfigureAwait(false);
case "!RESTART":
return ResponseRestart(steamID);
case "!STARTALL":
return await ResponseStartAll(steamID).ConfigureAwait(false);
case "!STATUS":
return ResponseStatus(steamID);
case "!STATUSALL":
@ -1249,6 +1251,20 @@ namespace ArchiSteamFarm {
return "Done!";
}
private static async Task<string> ResponseStartAll(ulong steamID) {
if (steamID == 0) {
Logging.LogNullError(nameof(steamID));
return null;
}
if (!IsOwner(steamID)) {
return null;
}
await Task.WhenAll(Bots.Where(bot => !bot.Value.KeepRunning).Select(bot => bot.Value.ResponseStart(steamID))).ConfigureAwait(false);
return "Done!";
}
private async Task<string> ResponseAddLicense(ulong steamID, ICollection<uint> gameIDs) {
if ((steamID == 0) || (gameIDs == null) || (gameIDs.Count == 0)) {
Logging.LogNullError(nameof(steamID) + " || " + nameof(gameIDs) + " || " + nameof(gameIDs.Count), BotName);