Interface IComponentService
Holds all methods to setup, build and execute interaction components.
Namespace: Color_Chan.Discord.Commands.Services
Assembly: Color-Chan.Discord.Commands.dll
Syntax
public interface IComponentService
Methods
| Improve this Doc View SourceAddComponentsAsync(Assembly)
Adds all components in an assembly
to the component registry.
Declaration
Task AddComponentsAsync(Assembly assembly)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.Assembly | assembly | The assembly where the IComponentInteractionModule are located. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
System.Exception | Thrown when 2 or more component had the same custom id. |
ExecuteComponentInteractionAsync(IComponentContext, IServiceProvider)
Executes a component interaction.
Declaration
Task<Result<IDiscordInteractionResponse>> ExecuteComponentInteractionAsync(IComponentContext context, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
IComponentContext | context | The context of the interaction. |
System.IServiceProvider | serviceProvider | The services needed for the interaction. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Result<IDiscordInteractionResponse>> | The Result containing the result of the component interaction execution. |
ExecuteComponentInteractionAsync(IComponentInfo, IComponentContext, IServiceProvider)
Executes a component interaction.
Declaration
Task<Result<IDiscordInteractionResponse>> ExecuteComponentInteractionAsync(IComponentInfo componentInfo, IComponentContext context, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
IComponentInfo | componentInfo | The IComponentInfo that will be executed. |
IComponentContext | context | The context of the interaction. |
System.IServiceProvider | serviceProvider | The services needed for the interaction. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Result<IDiscordInteractionResponse>> | The Result containing the result of the component interaction execution. |
SearchComponent(String)
Search for a registered component.
Declaration
IComponentInfo SearchComponent(string customId)
Parameters
Type | Name | Description |
---|---|---|
System.String | customId | The CustomId of the component. |
Returns
Type | Description |
---|---|
IComponentInfo | A IComponentInfo if one was found. Null if no IComponentInfo was found. |