SHARE
TWEET

Untitled

a guest Aug 25th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  public void Configure(IApplicationBuilder app)
  2.         {
  3.             var serviceProvider = app.ApplicationServices;
  4.             ServiceProvider = serviceProvider;
  5.  
  6.             app
  7.                 .UseCors(o => o.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin())
  8.                 .UseMvc()
  9.                 .UseWelcomePage();
  10.  
  11.             serviceProvider.GetRequiredService<LoggingService>();
  12.             serviceProvider.GetRequiredService<MessageHandler>();
  13.             serviceProvider.GetRequiredService<UserJoinedHandler>();
  14.  
  15.             serviceProvider.GetRequiredService<Statistics>().Init().Wait();
  16.             serviceProvider.GetRequiredService<DiscordService>().StartAsync().Wait();
  17.         }
  18.  
  19.  public async Task StartAsync()
  20.         {
  21.             var dcConfig = Config.GetSection("Discord");
  22.             var token = dcConfig["Token"];
  23.             var activityMessage = dcConfig["Activity"];
  24.  
  25.             if (string.IsNullOrEmpty(token))
  26.                 throw new ConfigException("Missing bot token in config.");
  27.  
  28.             await Client.LoginAsync(TokenType.Bot, token);
  29.             await Client.StartAsync();
  30.             await SetActivity(activityMessage);
  31.  
  32.             await Commands.AddModulesAsync(Assembly.GetEntryAssembly(), Services);
  33.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top