Table of Contents

Interface ICommand

Namespace
Signal.Application.Commands
Assembly
Signal.Application.dll

A class-based command. Instances are resolved from the message's DI scope, so constructor injection works. Arguments are not bound automatically; read Arguments and Flags.

public interface ICommand

Remarks

Derive from CommandBase to take metadata from a CommandAttribute.

Properties

Aliases

Alternative names.

IReadOnlyList<string> Aliases { get; }

Property Value

IReadOnlyList<string>

Description

One-line description for the help listing.

string? Description { get; }

Property Value

string

Hidden

Whether the command is hidden from the help listing.

bool Hidden { get; }

Property Value

bool

Name

The command name (typed after the prefix).

string Name { get; }

Property Value

string

Usage

Usage text without prefix, e.g. ban <number> [reason...].

string? Usage { get; }

Property Value

string

Methods

ExecuteAsync(CommandContext, CancellationToken)

Executes the command.

Task ExecuteAsync(CommandContext context, CancellationToken cancellationToken)

Parameters

context CommandContext

The command context (message, arguments, services, reply helpers).

cancellationToken CancellationToken

Cancelled when the host shuts down.

Returns

Task

A task that completes when the command has finished.