Table of Contents

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

TContext

The 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

configuration ComponentInteractionServiceConfiguration<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

builder ComponentInteractionBuilder

The component interaction builder.

AddModule(Type)

Adds a module to the service.

public void AddModule(Type type)

Parameters

type Type

The type of the module to add.

AddModule<T>()

Adds a module to the service.

public void AddModule<T>()

Type Parameters

T

The type of the module to add.

AddModules(Assembly)

Scans the specified assembly for public modules and registers them with the service.

public void AddModules(Assembly assembly)

Parameters

assembly Assembly

The assembly to scan for modules.

ExecuteAsync(TContext, IServiceProvider?)

Executes a component interaction.

public ValueTask<IExecutionResult> ExecuteAsync(TContext context, IServiceProvider? serviceProvider = null)

Parameters

context TContext

The component interaction context.

serviceProvider IServiceProvider

The 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.