Search Results for

    Show / Hide Table of Contents

    Class SlashCommandService

    Holds all methods to setup, build and execute slash commands.

    Inheritance
    System.Object
    SlashCommandService
    Implements
    ISlashCommandService
    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 SlashCommandService : ISlashCommandService

    Constructors

    | Improve this Doc View Source

    SlashCommandService(ILogger<SlashCommandService>, ISlashCommandBuildService, ISlashCommandRequirementService, ISlashCommandAutoSyncService)

    Initializes a new instance of SlashCommandService.

    Declaration
    public SlashCommandService(ILogger<SlashCommandService> logger, ISlashCommandBuildService slashCommandBuildService, ISlashCommandRequirementService requirementService, ISlashCommandAutoSyncService commandAutoSyncService)
    Parameters
    Type Name Description
    Microsoft.Extensions.Logging.ILogger<SlashCommandService> logger

    The Microsoft.Extensions.Logging.ILogger for SlashCommandService.

    ISlashCommandBuildService slashCommandBuildService

    The ISlashCommandBuildService that will get and build the commands.

    ISlashCommandRequirementService requirementService

    The ISlashCommandRequirementService that will used to execute the requirements.

    ISlashCommandAutoSyncService commandAutoSyncService

    The ISlashCommandAutoSyncService that handles all the syncing of the slash commands.

    Methods

    | Improve this Doc View Source

    AddInteractionCommandsAsync(Assembly)

    Add all interaction commands in an System.Reflection.Assembly to the ISlashCommandService.

    Declaration
    public async Task AddInteractionCommandsAsync(Assembly assembly)
    Parameters
    Type Name Description
    System.Reflection.Assembly assembly

    The System.Reflection.Assembly where the commands are located.

    Returns
    Type Description
    System.Threading.Tasks.Task
    See Also
    Result
    SlashCommandAttribute
    | Improve this Doc View Source

    ExecuteSlashCommandAsync(ISlashCommandContext, IEnumerable<IDiscordInteractionOption>, IServiceProvider)

    Execute a specific command with their dependencies. The command will be searched for with its Name.

    Declaration
    public async Task<Result<IDiscordInteractionResponse>> ExecuteSlashCommandAsync(ISlashCommandContext context, IEnumerable<IDiscordInteractionOption> options = null, IServiceProvider serviceProvider = null)
    Parameters
    Type Name Description
    ISlashCommandContext context

    The current ISlashCommandContext that will be passed to the command module.

    System.Collections.Generic.IEnumerable<IDiscordInteractionOption> options

    The options used with the command.

    System.IServiceProvider serviceProvider

    The System.IServiceProvider containing the necessary dependencies for the the module of the command.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordInteractionResponse>>

    The Result containing the result of the command execution.

    See Also
    Result
    SlashCommandAttribute
    | Improve this Doc View Source

    ExecuteSlashCommandAsync(ISlashCommandInfo, ISlashCommandContext, List<IDiscordInteractionOption>, IServiceProvider)

    Execute a specific command with their dependencies. The command will be searched for with its Name.

    Declaration
    public async Task<Result<IDiscordInteractionResponse>> ExecuteSlashCommandAsync(ISlashCommandInfo commandInfo, ISlashCommandContext context, List<IDiscordInteractionOption> suppliedOptions = null, IServiceProvider serviceProvider = null)
    Parameters
    Type Name Description
    ISlashCommandInfo commandInfo

    The command that will be executed.

    ISlashCommandContext context

    The current ISlashCommandContext that will be passed to the command module.

    System.Collections.Generic.List<IDiscordInteractionOption> suppliedOptions

    The options used by the user.

    System.IServiceProvider serviceProvider

    The System.IServiceProvider containing the necessary dependencies for the the module of the command.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordInteractionResponse>>

    The Result containing the result of the command execution.

    See Also
    Result
    SlashCommandAttribute
    | Improve this Doc View Source

    ExecuteSlashCommandAsync(ISlashCommandOptionInfo, ISlashCommandContext, List<IDiscordInteractionOption>, IServiceProvider)

    Execute a specific command with their dependencies. The command will be searched for with its Name.

    Declaration
    public async Task<Result<IDiscordInteractionResponse>> ExecuteSlashCommandAsync(ISlashCommandOptionInfo commandOptionInfo, ISlashCommandContext context, List<IDiscordInteractionOption> suppliedOptions = null, IServiceProvider serviceProvider = null)
    Parameters
    Type Name Description
    ISlashCommandOptionInfo commandOptionInfo

    The sub command that will be executed.

    ISlashCommandContext context

    The current ISlashCommandContext that will be passed to the command module.

    System.Collections.Generic.List<IDiscordInteractionOption> suppliedOptions

    The options used by the user.

    System.IServiceProvider serviceProvider

    The System.IServiceProvider containing the necessary dependencies for the the module of the command.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordInteractionResponse>>

    The Result containing the result of the command execution.

    See Also
    Result
    SlashCommandAttribute
    | Improve this Doc View Source

    ExecuteSlashCommandAsync(MethodInfo, IEnumerable<ISlashCommandOptionInfo>, IEnumerable<InteractionRequirementAttribute>, ISlashCommandContext, List<IDiscordInteractionOption>, IServiceProvider)

    Execute a specific command with their dependencies. The command will be searched for with its Name.

    Declaration
    public async Task<Result<IDiscordInteractionResponse>> ExecuteSlashCommandAsync(MethodInfo commandMethod, IEnumerable<ISlashCommandOptionInfo> options, IEnumerable<InteractionRequirementAttribute> requirements, ISlashCommandContext context, List<IDiscordInteractionOption> suppliedOptions = null, IServiceProvider serviceProvider = null)
    Parameters
    Type Name Description
    System.Reflection.MethodInfo commandMethod

    The command method that will be executed.

    System.Collections.Generic.IEnumerable<ISlashCommandOptionInfo> options

    The command options of the command.

    System.Collections.Generic.IEnumerable<InteractionRequirementAttribute> requirements

    The requirements before the command can be executed.

    ISlashCommandContext context

    The current ISlashCommandContext that will be passed to the command module.

    System.Collections.Generic.List<IDiscordInteractionOption> suppliedOptions

    The options used by the user.

    System.IServiceProvider serviceProvider

    The System.IServiceProvider containing the necessary dependencies for the the module of the command.

    Returns
    Type Description
    System.Threading.Tasks.Task<Result<IDiscordInteractionResponse>>

    The Result containing the result of the command execution.

    See Also
    Result
    SlashCommandAttribute
    | Improve this Doc View Source

    SearchSlashCommand(String)

    Search for a command by its Name.

    Declaration
    public ISlashCommandInfo SearchSlashCommand(string name)
    Parameters
    Type Name Description
    System.String name

    The name of the command.

    Returns
    Type Description
    ISlashCommandInfo

    The SlashCommandInfo containing the command.

    | Improve this Doc View Source

    SearchSlashCommand(String, String)

    Search for a sub command by its Name of the command module. And the Name of the sub slash command.

    Declaration
    public ISlashCommandOptionInfo SearchSlashCommand(string groupName, string subCommandName)
    Parameters
    Type Name Description
    System.String groupName

    The command group name.

    System.String subCommandName

    The name of the command.

    Returns
    Type Description
    ISlashCommandOptionInfo

    The ISlashCommandOptionInfo containing the sub command.

    | Improve this Doc View Source

    SearchSlashCommand(String, String, String)

    Search for a sub command by its Name of the command module. And the Name of the sub command group. And the Name of the sub slash command.

    Declaration
    public ISlashCommandOptionInfo SearchSlashCommand(string groupName, string subCommandGroupName, string subCommandName)
    Parameters
    Type Name Description
    System.String groupName

    The command group name.

    System.String subCommandGroupName

    The name of the sub command group.

    System.String subCommandName

    The name of the command.

    Returns
    Type Description
    ISlashCommandOptionInfo

    The ISlashCommandOptionInfo containing the sub command.

    Implements

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