Class ComponentInteractionService<TContext>
- Namespace
- NetCord.Services.ComponentInteractions
- Assembly
- NetCord.Services.dll
Provides functionality for handling component interactions.
public class ComponentInteractionService<TContext> : IComponentInteractionService, IService where TContext : IComponentInteractionContext
Type Parameters
TContextThe context the invoked component interactions use.
- Inheritance
-
ComponentInteractionService<TContext>
- Implements
- Inherited Members
Constructors
ComponentInteractionService(ComponentInteractionServiceConfiguration<TContext>?)
Provides functionality for handling component interactions.
public ComponentInteractionService(ComponentInteractionServiceConfiguration<TContext>? configuration = null)
Parameters
configurationComponentInteractionServiceConfiguration<TContext>The configuration for the component interaction service.
Properties
Configuration
The configuration for the component interaction service.
public ComponentInteractionServiceConfiguration<TContext> Configuration { get; }
Property Value
- ComponentInteractionServiceConfiguration<TContext>
Methods
AddComponentInteraction(ComponentInteractionBuilder)
Adds a component interaction to the service.
public void AddComponentInteraction(ComponentInteractionBuilder builder)
Parameters
builderComponentInteractionBuilderThe component interaction builder.
AddModule(Type)
Adds a module to the service.
public void AddModule(Type type)
Parameters
typeTypeThe type of the module to add.
AddModule<T>()
Adds a module to the service.
public void AddModule<T>()
Type Parameters
TThe type of the module to add.
AddModules(Assembly)
Scans the specified assembly for public modules and registers them with the service.
[RequiresUnreferencedCode("Types might be removed")]
public void AddModules(Assembly assembly)
Parameters
assemblyAssemblyThe assembly to scan for modules.
ExecuteAsync(TContext, IServiceProvider?)
Executes a component interaction.
public ValueTask<IExecutionResult> ExecuteAsync(TContext context, IServiceProvider? serviceProvider = null)
Parameters
contextTContextThe component interaction context.
serviceProviderIServiceProviderThe service provider for dependency injection.
Returns
- ValueTask<IExecutionResult>
A task representing the execution result.
GetComponentInteractions()
Gets the collection of component interactions registered in the service.
public IReadOnlyDictionary<ReadOnlyMemory<char>, ComponentInteractionInfo<TContext>> GetComponentInteractions()
Returns
- IReadOnlyDictionary<ReadOnlyMemory<char>, ComponentInteractionInfo<TContext>>
The collection of component interactions registered in the service.