Table of Contents
API reference

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

services IServiceCollection

The service collection to update.

configure Action<DiscordWebIngressOptions>

Optional configuration callback for the ingress subsystem.

configureAspNetCore Action<DiscordAspNetCoreIngressOptions>

Optional configuration callback for ASP.NET Core endpoint conventions.

configureOAuth Action<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

services is null.