From 87e80ff428621ac4d52d6cd66c3c584b55e8a774 Mon Sep 17 00:00:00 2001 From: KubaZ2 Date: Wed, 8 Apr 2026 15:47:18 +0200 Subject: [PATCH] Add type overloads for AddGatewayHandler methods --- ...tewayHandlerServiceCollectionExtensions.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Hosting/NetCord.Hosting/Gateway/GatewayHandlerServiceCollectionExtensions.cs b/Hosting/NetCord.Hosting/Gateway/GatewayHandlerServiceCollectionExtensions.cs index 2d810da1..095e2241 100644 --- a/Hosting/NetCord.Hosting/Gateway/GatewayHandlerServiceCollectionExtensions.cs +++ b/Hosting/NetCord.Hosting/Gateway/GatewayHandlerServiceCollectionExtensions.cs @@ -32,6 +32,18 @@ public static IServiceCollection AddGatewayHandler(this IServiceCollection se return services; } + /// + /// Adds an to the specified . + /// + /// The to add the to. + /// The type of the to add. + /// A reference to this instance after the operation has completed. + public static IServiceCollection AddGatewayHandler(this IServiceCollection services, [DAM(DAMT.PublicConstructors)] Type handlerType) + { + services.AddSingleton(typeof(IGatewayHandler), handlerType); + return services; + } + /// /// Adds an to the specified . /// @@ -97,6 +109,18 @@ public static IServiceCollection AddShardedGatewayHandler(this IServiceCollec return services; } + /// + /// Adds an to the specified . + /// + /// The to add the to. + /// The type of the to add. + /// A reference to this instance after the operation has completed. + public static IServiceCollection AddShardedGatewayHandler(this IServiceCollection services, [DAM(DAMT.PublicConstructors)] Type handlerType) + { + services.AddSingleton(typeof(IShardedGatewayHandler), handlerType); + return services; + } + /// /// Adds an to the specified . ///