You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

service-registration.cs 519 B

123456789101112131415161718192021
  1. static IServiceProvider CreateServices()
  2. {
  3. var config = new DiscordSocketConfig()
  4. {
  5. //...
  6. };
  7. // X represents either Interaction or Command, as it functions the exact same for both types.
  8. var servConfig = new XServiceConfig()
  9. {
  10. //...
  11. }
  12. var collection = new ServiceCollection()
  13. .AddSingleton(config)
  14. .AddSingleton<DiscordSocketClient>()
  15. .AddSingleton(servConfig)
  16. .AddSingleton<XService>();
  17. return collection.BuildServiceProvider();
  18. }