diff --git a/DisCatSharp.Hosting.DependencyInjection/ServiceCollectionExtensions.cs b/DisCatSharp.Hosting.DependencyInjection/ServiceCollectionExtensions.cs
index b2e19d45f..b6e309496 100644
--- a/DisCatSharp.Hosting.DependencyInjection/ServiceCollectionExtensions.cs
+++ b/DisCatSharp.Hosting.DependencyInjection/ServiceCollectionExtensions.cs
@@ -1,28 +1,46 @@
using Microsoft.Extensions.DependencyInjection;
namespace DisCatSharp.Hosting.DependencyInjection
{
///
/// The service collection extensions.
///
public static class ServiceCollectionExtensions
{
///
/// Add as a background service
///
///
/// is scoped to ServiceLifetime.Singleton.
/// Maps to Implementation of
///
///
///
///
public static IServiceCollection AddDiscordHostedService(this IServiceCollection services)
where TService : class, IDiscordHostedService
{
services.AddSingleton();
services.AddHostedService(provider => provider.GetRequiredService());
return services;
}
+
+ ///
+ /// Add as a background service which derives from
+ /// and
+ ///
+ ///
+ /// Interface which inherits from
+ /// Your custom bot
+ ///
+ public static IServiceCollection AddDiscordHostedService(this IServiceCollection services)
+ where TInterface : class, IDiscordHostedService
+ where TService : class, TInterface, IDiscordHostedService
+ {
+ services.AddSingleton();
+ services.AddHostedService(provider => provider.GetRequiredService());
+
+ return services;
+ }
}
}