public static async Task Main() { try { var serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); ServiceProvider = serviceCollection.BuildServiceProvider(); await Launcher.RunAsync().ConfigureAwait(false); } catch (Exception ex) { Console.Error.WriteLine($"A fatal error caused the bot to crash: {ex}"); } }
public static async Task Main() { try { var serviceCollection = new ServiceCollection(); ServiceProvider = ConfigureServices(); Console.CancelKeyPress += async(s, e) => await Launcher.ShutdownAsync().ConfigureAwait(false); await Launcher.RunAsync().ConfigureAwait(false); } catch (Exception ex) { Console.Error.WriteLine($"A fatal error caused the bot to crash: {ex}"); } }