Interface ISlashCommandService
Holds all methods to setup, build and execute slash commands.
Namespace: Color_Chan.Discord.Commands.Services
Assembly: Color-Chan.Discord.Commands.dll
Syntax
public interface ISlashCommandService
Methods
| Improve this Doc View SourceAddInteractionCommandsAsync(Assembly)
Add all interaction commands in an System.Reflection.Assembly to the ISlashCommandService.
Declaration
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
| Improve this Doc View SourceExecuteSlashCommandAsync(ISlashCommandContext, IEnumerable<IDiscordInteractionOption>, IServiceProvider)
Execute a specific command with their dependencies. The command will be searched for with its Name.
Declaration
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
| Improve this Doc View SourceExecuteSlashCommandAsync(ISlashCommandInfo, ISlashCommandContext, List<IDiscordInteractionOption>, IServiceProvider)
Execute a specific command with their dependencies. The command will be searched for with its Name.
Declaration
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
| Improve this Doc View SourceExecuteSlashCommandAsync(ISlashCommandOptionInfo, ISlashCommandContext, List<IDiscordInteractionOption>, IServiceProvider)
Execute a specific command with their dependencies. The command will be searched for with its Name.
Declaration
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
| Improve this Doc View SourceExecuteSlashCommandAsync(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
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
| Improve this Doc View SourceSearchSlashCommand(String)
Search for a command by its Name.
Declaration
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. |
SearchSlashCommand(String, String)
Declaration
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. |
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
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. |