Class SlashCommandBuildService
Holds all the methods to build the ISlashCommandInfo.
Inheritance
Implements
Inherited Members
Namespace: Color_Chan.Discord.Commands.Services.Implementations.Builders
Assembly: Color-Chan.Discord.Commands.dll
Syntax
public class SlashCommandBuildService : ISlashCommandBuildService
Constructors
| Improve this Doc View SourceSlashCommandBuildService(ISlashCommandRequirementBuildService, ISlashCommandGuildBuildService, ILogger<SlashCommandBuildService>, ISlashCommandOptionBuildService)
Initializes a new instance of SlashCommandBuildService.
Declaration
public SlashCommandBuildService(ISlashCommandRequirementBuildService requirementBuildService, ISlashCommandGuildBuildService guildBuildService, ILogger<SlashCommandBuildService> logger, ISlashCommandOptionBuildService optionBuildService)
Parameters
Type | Name | Description |
---|---|---|
ISlashCommandRequirementBuildService | requirementBuildService | The ISlashCommandRequirementBuildService that will get and build the command requirements. |
ISlashCommandGuildBuildService | guildBuildService | The ISlashCommandGuildBuildService that will get and build the guild attributes. |
Microsoft.Extensions.Logging.ILogger<SlashCommandBuildService> | logger | The Microsoft.Extensions.Logging.ILogger for SlashCommandBuildService. |
ISlashCommandOptionBuildService | optionBuildService | The ISlashCommandOptionBuildService that will get and build the ISlashCommandOptionInfos. |
Methods
| Improve this Doc View SourceBuildSlashCommandInfos(Assembly)
Builds all commands in a specific assembly
and stores them in a
System.Collections.Generic.IReadOnlyList<T> of System.Collections.Generic.KeyValuePair`2 of System.String,
ISlashCommandInfo.
Declaration
public IReadOnlyList<KeyValuePair<string, ISlashCommandInfo>> BuildSlashCommandInfos(Assembly assembly)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.Assembly | assembly | The System.Reflection.Assembly where the ISlashCommandBuildService will search for commands. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<System.String, ISlashCommandInfo>> | A System.Collections.Generic.IReadOnlyList<T> of System.Collections.Generic.KeyValuePair`2 of System.String, ISlashCommandInfo. The key System.String contains the command name. And the value ISlashCommandInfo contains the commands information to execute it. |
BuildSlashCommandsParams(IEnumerable<ISlashCommandInfo>)
Builds the slash command parameters so it can be send to Discord's API.
Declaration
public IEnumerable<DiscordCreateApplicationCommand> BuildSlashCommandsParams(IEnumerable<ISlashCommandInfo> commandInfos)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ISlashCommandInfo> | commandInfos | The ISlashCommandInfos. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<DiscordCreateApplicationCommand> | The build slash command parameters. |
GetSlashCommandModules(Assembly)
Get all the interaction command modules. These modules need to inherit ISlashCommandModule so they can be found by the ISlashCommandBuildService.
Declaration
public IEnumerable<TypeInfo> GetSlashCommandModules(Assembly assembly)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.Assembly | assembly | The System.Reflection.Assembly where the ISlashCommandBuildService will search for the modules. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Reflection.TypeInfo> | A System.Collections.Generic.IEnumerable<T> of System.Reflection.TypeInfos that inherits ISlashCommandModule. |