Search Results for

    Show / Hide Table of Contents

    Class ComponentService

    Holds all methods to setup, build and execute interaction components.

    Inheritance
    System.Object
    ComponentService
    Implements
    IComponentService
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Color_Chan.Discord.Commands.Services.Implementations
    Assembly: Color-Chan.Discord.Commands.dll
    Syntax
    public class ComponentService : IComponentService

    Constructors

    | Improve this Doc View Source

    ComponentService(ILogger<ComponentService>, IComponentBuildService, ISlashCommandRequirementService)

    Initializes a new instance of ComponentService.

    Declaration
    public ComponentService(ILogger<ComponentService> logger, IComponentBuildService componentBuildService, ISlashCommandRequirementService requirementService)
    Parameters
    Type Name Description
    Microsoft.Extensions.Logging.ILogger<ComponentService> logger

    The Microsoft.Extensions.Logging.ILogger for ComponentService.

    IComponentBuildService componentBuildService

    The build service that will build the IComponentInfos.

    ISlashCommandRequirementService requirementService

    The ISlashCommandRequirementService that will used to execute the requirements.

    Methods

    | Improve this Doc View Source

    AddComponentsAsync(Assembly)

    Adds all components in an assembly to the component registry.

    Declaration
    public 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.

    | Improve this Doc View Source

    ExecuteComponentInteractionAsync(IComponentContext, IServiceProvider)

    Executes a component interaction.

    Declaration
    public async 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.

    | Improve this Doc View Source

    ExecuteComponentInteractionAsync(IComponentInfo, IComponentContext, IServiceProvider)

    Executes a component interaction.

    Declaration
    public async 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.

    | Improve this Doc View Source

    SearchComponent(String)

    Search for a registered component.

    Declaration
    public 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.

    Implements

    IComponentService
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX