Interface ICommandContext
Represents a command context.
Namespace: OpenMod.API.Commands
Assembly: OpenMod.API.dll
Syntax
public interface ICommandContext : IAsyncDisposable
Properties
| Improve this Doc View SourceActor
Gets the actor executing command.
Declaration
ICommandActor Actor { get; }
Property Value
Type | Description |
---|---|
ICommandActor |
ChildContext
Gets the child command context.
Declaration
ICommandContext ChildContext { get; }
Property Value
Type | Description |
---|---|
ICommandContext |
CommandAlias
Gets the alias or name used to execute the command.
Declaration
string CommandAlias { get; }
Property Value
Type | Description |
---|---|
System.String |
CommandPrefix
Gets the prefix used to call the command.
Useful for sending command usage messages.
Child commands will include their parents.
Declaration
string CommandPrefix { get; }
Property Value
Type | Description |
---|---|
System.String |
Examples
If the command was executed using "/mycommand", it will be "/", when it was executed using "!mycommand", it will be "!".
If the command was a ChildrenCommand "sub", "/mycommand sub" will return "/mycommand" as prefix.
| Improve this Doc View SourceCommandRegistration
Gets the command registration. Returns null if the command was not found.
Declaration
ICommandRegistration CommandRegistration { get; }
Property Value
Type | Description |
---|---|
ICommandRegistration |
Data
Gets the data for the context. Can be used by plugins for passing arbritrary data to the command context.
Declaration
Dictionary<string, object> Data { get; }
Property Value
Type | Description |
---|---|
Dictionary<System.String, System.Object> |
Exception
Gets the exception thrown by the command if one was thrown; otherwise, null.
Declaration
Exception? Exception { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<Exception> |
Parameters
Gets the parameters of the command.
Declaration
ICommandParameters Parameters { get; }
Property Value
Type | Description |
---|---|
ICommandParameters |
ParentContext
Gets the parent command context.
Declaration
ICommandContext ParentContext { get; }
Property Value
Type | Description |
---|---|
ICommandContext |
Examples
If the command was entered as "/mycommand sub", this will return the parent context with parameters "sub".
| Improve this Doc View SourceRootContext
Gets the root context.
Declaration
ICommandContext RootContext { get; }
Property Value
Type | Description |
---|---|
ICommandContext |
ServiceProvider
Gets the service provider for the command context.
Declaration
IServiceProvider ServiceProvider { get; }
Property Value
Type | Description |
---|---|
IServiceProvider |