Table of Contents

Interface IPluginCommandRegistry

Namespace
AcDream.Plugin.Abstractions
Assembly
AcDream.Plugin.Abstractions.dll

Lets a plugin claim chat commands, including aliases and typed completion.

public interface IPluginCommandRegistry

Properties

Definitions

Returns definitions matching a verb, or all definitions for help.

IReadOnlyList<IPluginCommandDefinition> Definitions { get; }

Property Value

IReadOnlyList<IPluginCommandDefinition>

Methods

CompleteAsync(PluginCommand, CancellationToken)

Completes a partially typed command without blocking the caller.

ValueTask<IReadOnlyList<PluginCommandCompletion>> CompleteAsync(PluginCommand command, CancellationToken cancellationToken = default)

Parameters

command PluginCommand

What the player has typed so far.

cancellationToken CancellationToken

Cancels the completion.

Returns

ValueTask<IReadOnlyList<PluginCommandCompletion>>

The candidates; empty on a host that does not implement completion.

GetHelp()

Creates help text from registered command descriptions.

string GetHelp()

Returns

string

One line per command; empty on a host that does not implement help.

Register(IPluginCommandDefinition)

Registers a command and all its aliases as one owned registration.

IDisposable Register(IPluginCommandDefinition definition)

Parameters

definition IPluginCommandDefinition

The command, its aliases and its completion.

Returns

IDisposable

Dispose it to give the command and its aliases up.

Remarks

A host that does not implement this registers the verb alone: no aliases, no completion, no help.

Register(string, Action<PluginCommand>)

Claims one command word.

IDisposable Register(string verb, Action<PluginCommand> handler)

Parameters

verb string

The command word, without a leading slash.

handler Action<PluginCommand>

Called each time the player types the command.

Returns

IDisposable

Dispose it to give the word up.