Roblox UtilitiesDevlHub Roblox Documentation

Class

TextChatCommand

Inherits
Instance › Object
Memory category
Instances

Represents a text chat command.

Represents a text chat command. Can be used to create custom text chat commands when parented to TextChatService.

Custom commands can have up to two aliases, and the Triggered event fires when a user's message matches the value of either the PrimaryAlias or SecondaryAlias. For an example of custom commands, see Custom text chat commands.

To learn more about using TextChatService, see In-experience text chat.

Properties 4#

AutocompleteVisiblebooleanDetermines whether the TextChatCommand is shown as a suggestion in the chat autocomplete menu.ReadSafe
EnabledbooleanDetermines whether the TextChatCommand is enabled.ReadSafe
PrimaryAliasstringA primary alias used to trigger the TextChatCommand.ReadSafe
SecondaryAliasstringA secondary alias used to trigger the TextChatCommand.ReadSafe

AutocompleteVisible: boolean#

ReadSafe

Whether this TextChatCommand appears as a suggestion in the chat autocomplete menu. Defaults to true.

When true, PrimaryAlias is offered in the autocomplete list. Set to false to hide it from suggestions; the command still works when typed in full via PrimaryAlias or SecondaryAlias.

Autocomplete itself is controlled by ChatInputBarConfiguration.AutocompleteEnabled.

Enabled: boolean#

ReadSafe

Determines whether the TextChatCommand is enabled.

When disabled, messages that match the value of PrimaryAlias or SecondaryAlias are not sunk and is sent to other users.

Use this to disable default commands on a case-by-case basis.

PrimaryAlias: string#

ReadSafe

A primary alias used to trigger the TextChatCommand.

If a user sends a message with TextChannel:SendAsync() that matches the PrimaryAlias, the message is not sent and instead TextChatCommand.Triggered is fired.

SecondaryAlias: string#

ReadSafe

A secondary alias used to trigger the TextChatCommand, in addition to its PrimaryAlias.

If a user sends a message with TextChannel:SendAsync() that matches the SecondaryAlias, the message is not sent and instead TextChatCommand.Triggered is fired, exactly as it is for the PrimaryAlias. Matching is case-insensitive, and the alias must be followed by the end of the message or a space, so a SecondaryAlias of "/e" matches "/e" and "/e dance" but not "/emote".

Defaults to an empty string, in which case only the PrimaryAlias triggers the command.

Events 1#

TriggeredAn event that developers can bind to execute commands.

Triggered(originTextSource: TextSource, unfilteredText: string)#

An event that developers can bind to execute commands.

When a user sends a message to the server via TextChannel:SendAsync(), the message is intercepted by the TextChatCommand and not replicated to other users if the content of the message matches the PrimaryAlias or SecondaryAlias.

For example, for a TextChatCommand with TextChatCommand.PrimaryAlias as "mute", if a user sends "/mute SomeUserName", then the relevant TextChatCommand for mute will fire its TextChatCommand.Triggered. The message "/mute SomeUserName" is not replicated to other users.

NameTypeDefaultDescription
originTextSourceTextSourceA reference to the TextSource responsible for triggering the command via TextChannel:SendAsync().
unfilteredTextstringThe full, unfiltered text used to trigger the command that can be used to dissect parameters from the command message.

Inherited members#

Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed