예제 #1
0
 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}");
     }
 }
예제 #2
0
        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}");
            }
        }