diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 99432e9b4..e8f74295e 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -114,14 +114,6 @@ namespace ArchiSteamFarm { return Bots.Count; } - internal static async Task ShutdownAllBots() { - List tasks = new List(); - foreach (Bot bot in Bots.Values) { - tasks.Add(Task.Run(async () => await bot.Shutdown().ConfigureAwait(false))); - } - await Task.WhenAll(tasks).ConfigureAwait(false); - } - internal static void RefreshCMs() { bool initialized = false; while (!initialized) { @@ -832,10 +824,10 @@ namespace ArchiSteamFarm { case "!2faoff": return Response2FAOff(BotName); case "!exit": - await ShutdownAllBots().ConfigureAwait(false); + Program.Exit(); return "Done"; case "!restart": - await Program.Restart().ConfigureAwait(false); + Program.Restart(); return "Done"; case "!status": return ResponseStatus(); diff --git a/ArchiSteamFarm/Program.cs b/ArchiSteamFarm/Program.cs index eb4f3a754..33d361d7e 100644 --- a/ArchiSteamFarm/Program.cs +++ b/ArchiSteamFarm/Program.cs @@ -93,15 +93,13 @@ namespace ArchiSteamFarm { } } - internal static async Task Exit(int exitCode = 0) { - await Bot.ShutdownAllBots().ConfigureAwait(false); + internal static void Exit(int exitCode = 0) { Environment.Exit(exitCode); } - internal static async Task Restart() { - await Bot.ShutdownAllBots().ConfigureAwait(false); + internal static void Restart() { System.Diagnostics.Process.Start(ExecutableFile, string.Join(" ", Environment.GetCommandLineArgs())); - Environment.Exit(0); + Exit(); } internal static async Task LimitSteamRequestsAsync() { @@ -259,7 +257,7 @@ namespace ArchiSteamFarm { if (!Directory.Exists(ConfigDirectory)) { Logging.LogGenericError("Config directory doesn't exist!"); Thread.Sleep(5000); - Task.Run(async () => await Exit(1).ConfigureAwait(false)).Wait(); + Exit(1); } // Before attempting to connect, initialize our list of CMs