CommandContext

Properties

# Cmdr

CommandContext.Cmdr: Cmdr | CmdrClient

A reference to Cmdr. This may either be the server or client version of Cmdr depending on where the command is running.

# Dispatcher

CommandContext.Dispatcher: Dispatcher

The dispatcher that created this command.

# Name

CommandContext.Name: string

The name of the command.

# Alias

CommandContext.Alias: string

The specific alias of this command that was used to trigger this command (may be the same as Name)

# RawText

CommandContext.RawText: string

The raw text that was used to trigger this command.

# Group

CommandContext.Group:

The group this command is a part of. Defined in command definitions, typically a string.

# State

CommandContext.State: table

A blank table that can be used to store user-defined information about this command's current execution. This could potentially be used with hooks to add information to this table which your command or other hooks could consume.

# Aliases

CommandContext.Aliases: array<string>

Any aliases that can be used to also trigger this command in addition to its name.

# Description

CommandContext.Description: string

The description for this command from the command definition.

# Executor

CommandContext.Executor: Player

The player who ran this command.

# RawArguments

CommandContext.RawArguments: array<string>

An array of strings which is the raw value for each argument.

# Arguments

CommandContext.Arguments: array<ArgumentContext>

An array of ArgumentContext objects, the parsed equivalent to RawArguments.

# Response

CommandContext.Response: string?

The command output, if the command has already been run. Typically only accessible in the AfterRun hook.

Instance Methods

# GetArguments

CommandContext.GetArguments(index: number) → ArgumentContext

Returns the ArgumentContext for the given index.

Parameters

Name Type Required
index number

Returns

Type
ArgumentContext

# GetData

CommandContext.GetData() →

Returns the command data that was sent along with the command. This is the return value of the Data function from the command definition.

Returns

Type

# GetStore

CommandContext.GetStore(name: string) → table

Returns a table of the given name. Always returns the same table on subsequent calls. Useful for storing things like ban information. Same as Registry.GetStore.

Parameters

Name Type Required
name string

Returns

Type
table

# SendEvent

CommandContext.SendEvent(

player: Player,
event: string
) →

Sends a network event of the given name to the given player. See Network Event Handlers.

Parameters

Name Type Required
player Player
event string

Returns

Type

# BroadcastEvent

CommandContext.BroadcastEvent(

event: string,
...: any
) →

Broadcasts a network event to all players. See Network Event Handlers.

Parameters

Name Type Required
event string
... any

Returns

Type

# Reply

CommandContext.Reply(

text: string,
color?: Color3?
) →

Prints the given text in the user's console. Useful for when a command needs to print more than one message or is long-running. You should still return a string from the command implementation when you are finished, Reply should only be used to send additional messages before the final message.

Parameters

Name Type Required
text string
color Color3?

Returns

Type
Last Updated: 9/8/2019, 2:11:38 AM