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
Keyword
The keyword the command was typed with.
string Keyword { get; }
Property Value
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
Parameters
The parameters the command was given, in their order.
IEnumerable<ICommandParameterValue> Parameters { get; }
Property Value
Source
The source the message came from.
IMessageSource Source { get; }
Property Value
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
indexint
Returns
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
namestring
Returns
Type Parameters
T
SourceTo<TMessageSource>()
Returns the source as TMessageSource.
TMessageSource SourceTo<TMessageSource>() where TMessageSource : IMessageSource
Returns
- TMessageSource
Type Parameters
TMessageSource