API reference
Method AddDiscordSocialSdkSupport
- Namespace
- DisCatSharp.Hosting.AspNetCore
- Assembly
- DisCatSharp.Hosting.AspNetCore.dll
AddDiscordSocialSdkSupport(IServiceCollection, Func<IServiceProvider, DiscordClient>?)
Registers a bot-authenticated Social SDK client for dependency injection.
public static IServiceCollection AddDiscordSocialSdkSupport(this IServiceCollection services, Func<IServiceProvider, DiscordClient>? clientFactory = null)
Parameters
servicesIServiceCollectionThe service collection to update.
clientFactoryFunc<IServiceProvider, DiscordClient>Resolves the initialized bot client; when omitted, a registered DiscordClient is used.
Returns
- IServiceCollection
The service collection for chaining.
Remarks
The factory is evaluated when a client is first resolved. For a hosted bot, resolve its client only after the bot has initialized.