Method AddDisCatSharpAspNetCore
- Namespace
- DisCatSharp.Hosting.AspNetCore
- Assembly
- DisCatSharp.Hosting.AspNetCore.dll
AddDisCatSharpAspNetCore(IServiceCollection, Action<DiscordWebIngressOptions>?, Action<DiscordAspNetCoreIngressOptions>?, Action<DiscordOAuthIngressOptions>?)
Registers the baseline ASP.NET Core service dependencies used by the DisCatSharp web ingress scaffold.
public static IServiceCollection AddDisCatSharpAspNetCore(this IServiceCollection services, Action<DiscordWebIngressOptions>? configure = null, Action<DiscordAspNetCoreIngressOptions>? configureAspNetCore = null, Action<DiscordOAuthIngressOptions>? configureOAuth = null)
Parameters
servicesIServiceCollectionThe service collection to update.
configureAction<DiscordWebIngressOptions>Optional configuration callback for the ingress subsystem.
configureAspNetCoreAction<DiscordAspNetCoreIngressOptions>Optional configuration callback for ASP.NET Core endpoint conventions.
configureOAuthAction<DiscordOAuthIngressOptions>Optional configuration callback for the OAuth callback flow.
Returns
- IServiceCollection
The service collection for chaining purposes.
Examples
builder.Services
.AddDisCatSharpAspNetCore(
configure: options => options.ApplicationVerifyKey = "<discord-verify-key>",
configureOAuth: options => options.RedirectUri = "https://bot.example.com/discord/oauth/callback")
.AddDiscordInteractionIngressHandler<MyInteractionHandler>();
Remarks
This scaffold wires the transport-neutral ingress pipeline, including request body reading, pending-state storage, signature validation aggregation, webhook dispatch, OAuth callback processing, and the ASP.NET Core endpoint handlers consumed by EndpointRouteBuilderExtensions.
It does not register application-command execution on its own. Register one or more IDiscordInteractionIngressHandler implementations to bridge incoming interactions into your bot's command pipeline.
Exceptions
- ArgumentNullException
servicesis null.