Table of Contents

Interface ICommandContext

Namespace
BSGameLib.Chat
Assembly
BSGameLib.Chat.dll

The context a command runs with: what was typed and the values of its parameters.

public interface ICommandContext

Properties

Command

The command that is running.

ICommand Command { get; }

Property Value

ICommand

Keyword

The keyword the command was typed with.

string Keyword { get; }

Property Value

string

Message

The part of the message after the keyword that no parameter took. It is empty when the last parameter takes the rest of the line.

string Message { get; }

Property Value

string

Parameters

The parameters the command was given, in their order.

IEnumerable<ICommandParameterValue> Parameters { get; }

Property Value

IEnumerable<ICommandParameterValue>

Source

The source the message came from.

IMessageSource Source { get; }

Property Value

IMessageSource

Methods

GetParameterByIndex<T>(int)

Returns the parameter at index, counting from 0 in the command's parameter order, converted to T. Returns null when there is no such parameter.

ICommandParameterValue<T> GetParameterByIndex<T>(int index)

Parameters

index int

Returns

ICommandParameterValue<T>

Type Parameters

T

GetParameterByName<T>(string)

Returns the parameter named name, converted to T. Returns null when the command has no parameter of that name.

ICommandParameterValue<T> GetParameterByName<T>(string name)

Parameters

name string

Returns

ICommandParameterValue<T>

Type Parameters

T

SourceTo<TMessageSource>()

Returns the source as TMessageSource.

TMessageSource SourceTo<TMessageSource>() where TMessageSource : IMessageSource

Returns

TMessageSource

Type Parameters

TMessageSource