Skip to main content

Class CommandServiceExtensions

Provides extension methods for the Discord.Commands.CommandService class.

Assembly: Discord.Net.Commands.dll​
View Source​
Declaration
public static class CommandServiceExtensions

Methods​

GetExecutableCommandsAsync(ICollection<CommandInfo>, ICommandContext, IServiceProvider)​

Returns commands that can be executed under the current context.

View Source​
Declaration
public static async Task<IReadOnlyCollection<CommandInfo>> GetExecutableCommandsAsync(this ICollection<CommandInfo> commands, ICommandContext context, IServiceProvider provider)
Returns​

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.Commands.CommandInfo>>: A read-only collection of commands that can be executed under the current context.

Parameters​
TypeNameDescription
System.Collections.Generic.ICollection<Discord.Commands.CommandInfo>commandsThe set of commands to be checked against.
Discord.Commands.ICommandContextcontextThe current command context.
System.IServiceProviderproviderThe service provider used for dependency injection upon precondition check.

GetExecutableCommandsAsync(CommandService, ICommandContext, IServiceProvider)​

Returns commands that can be executed under the current context.

View Source​
Declaration
public static Task<IReadOnlyCollection<CommandInfo>> GetExecutableCommandsAsync(this CommandService commandService, ICommandContext context, IServiceProvider provider)
Returns​

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.Commands.CommandInfo>>: A read-only collection of commands that can be executed under the current context.

Parameters​
TypeNameDescription
Discord.Commands.CommandServicecommandServiceThe desired command service class to check against.
Discord.Commands.ICommandContextcontextThe current command context.
System.IServiceProviderproviderThe service provider used for dependency injection upon precondition check.

GetExecutableCommandsAsync(ModuleInfo, ICommandContext, IServiceProvider)​

Returns commands that can be executed under the current context.

View Source​
Declaration
public static async Task<IReadOnlyCollection<CommandInfo>> GetExecutableCommandsAsync(this ModuleInfo module, ICommandContext context, IServiceProvider provider)
Returns​

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.Commands.CommandInfo>>: A read-only collection of commands that can be executed under the current context.

Parameters​
TypeNameDescription
Discord.Commands.ModuleInfomoduleThe module to be checked against.
Discord.Commands.ICommandContextcontextThe current command context.
System.IServiceProviderproviderThe service provider used for dependency injection upon precondition check.