OpenMod Docs OpenMod Docs
OpenMod Docs OpenMod Docs
OpenMod .NET Plugin Framework.

Interface ICommandContext

Represents a command context.

Namespace: OpenMod.API.Commands
Assembly: OpenMod.API.dll
Syntax
public interface ICommandContext : IAsyncDisposable

Properties

| Improve this Doc View Source

Actor

Gets the actor executing command.

Declaration
ICommandActor Actor { get; }
Property Value
Type Description
ICommandActor
| Improve this Doc View Source

ChildContext

Gets the child command context.

Declaration
ICommandContext ChildContext { get; }
Property Value
Type Description
ICommandContext
| Improve this Doc View Source

CommandAlias

Gets the alias or name used to execute the command.

Declaration
string CommandAlias { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

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 Source

CommandRegistration

Gets the command registration. Returns null if the command was not found.

Declaration
ICommandRegistration CommandRegistration { get; }
Property Value
Type Description
ICommandRegistration
| Improve this Doc View Source

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>
| Improve this Doc View Source

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>
| Improve this Doc View Source

Parameters

Gets the parameters of the command.

Declaration
ICommandParameters Parameters { get; }
Property Value
Type Description
ICommandParameters
| Improve this Doc View Source

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 Source

RootContext

Gets the root context.

Declaration
ICommandContext RootContext { get; }
Property Value
Type Description
ICommandContext
| Improve this Doc View Source

ServiceProvider

Gets the service provider for the command context.

Declaration
IServiceProvider ServiceProvider { get; }
Property Value
Type Description
IServiceProvider

Extension Methods

CommandContextExtensions.GetCommandLine(ICommandContext, Boolean)
DisposeHelper.DisposeSyncOrAsync(Object)