Skip to content

Interface ICommandService

Namespace: Void.Proxy.Api.Commands
Assembly: Void.Proxy.Api.dll

Provides access to command dispatching and execution operations.

public interface ICommandService

Extension Methods

CommandServiceExtensions.Register(ICommandService, Func<IArgumentContext, LiteralArgumentBuilder>)

Properties

Dispatcher

Gets the dispatcher used to route commands to their handlers.

ICommandDispatcher Dispatcher { get; }

Property Value

ICommandDispatcher

Methods

CompleteAsync(string, ICommandSource, CancellationToken)

Completes the specified command input using available commands.

ValueTask<string[]> CompleteAsync(string input, ICommandSource source, CancellationToken cancellationToken = default)

Parameters

input string

The partial command to complete.

source ICommandSource

The initiator requesting completion suggestions.

cancellationToken CancellationToken

Token used to cancel the completion operation.

Returns

ValueTask<string[]>

An array of possible completions.

ExecuteAsync(ICommandSource, string, CancellationToken)

Executes a command on behalf of the specified source.

ValueTask<CommandExecutionResult> ExecuteAsync(ICommandSource source, string command, CancellationToken cancellationToken = default)

Parameters

source ICommandSource

The initiator of the command.

command string

The command string to execute.

cancellationToken CancellationToken

Token used to cancel the execution.

Returns

ValueTask<CommandExecutionResult>

A result describing the outcome of the command execution.

ExecuteAsync(ICommandSource, string, Side, CancellationToken)

Executes a command that originated from the specified origin.

ValueTask<CommandExecutionResult> ExecuteAsync(ICommandSource source, string command, Side origin, CancellationToken cancellationToken = default)

Parameters

source ICommandSource

The initiator of the command.

command string

The command string to execute.

origin Side

The side from which the command originated.

cancellationToken CancellationToken

Token used to cancel the execution.

Returns

ValueTask<CommandExecutionResult>

A result describing the outcome of the command execution.