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
Methods
CompleteAsync(PluginCommand, CancellationToken)
Completes a partially typed command without blocking the caller.
ValueTask<IReadOnlyList<PluginCommandCompletion>> CompleteAsync(PluginCommand command, CancellationToken cancellationToken = default)
Parameters
commandPluginCommandWhat the player has typed so far.
cancellationTokenCancellationTokenCancels 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
definitionIPluginCommandDefinitionThe 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
verbstringThe command word, without a leading slash.
handlerAction<PluginCommand>Called each time the player types the command.
Returns
- IDisposable
Dispose it to give the word up.