TextChatCommand
Represents a text chat command.
Memory category | Instances |
---|
Member index 5
Description
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 types "/{PrimaryAlias}" or "/{SecondaryAlias}" into the chat.
To learn more about using TextChatService, see In-Experience Text Chat.
History 8
- 596 Add AutocompleteVisible
- 553 Change Default of Enabled from to true
- 533 Change Tags of TextChatCommand from [NotBrowsable] to []
- 514 Add Triggered
- 514 Add SecondaryAlias
- 514 Add PrimaryAlias
- 514 Add Enabled
- 514 Add TextChatCommand
Members 5
AutocompleteVisible
Type | Default | |
---|---|---|
bool | true |
Thread safety | ReadSafe |
---|---|
Category | Behavior |
Loaded/Saved | true |
History 1
Enabled
Type | Default | |
---|---|---|
bool | true |
Determines whether the TextChatCommand is enabled.
When disabled, messages that match "/{PrimaryAlias}" or "/{SecondaryAlias}" is not sunk and is sent to other users.
Use this to disable default commands on a case-by-case basis.
Thread safety | ReadSafe |
---|---|
Category | Behavior |
Loaded/Saved | true |
PrimaryAlias
Type | Default | |
---|---|---|
string |
A primary alias used to trigger the TextChatCommand.
If a user sends a message with TextChannel:SendAsync() that matches "/{TextChatCommand.PrimaryAlias}", then the message is not sent and instead TextChatCommand.Triggered is fired.
Thread safety | ReadSafe |
---|---|
Category | Behavior |
Loaded/Saved | true |
History 1
- 514 Add PrimaryAlias
SecondaryAlias
Type | Default | |
---|---|---|
string |
A secondary alias used to trigger the TextChatCommand.
Thread safety | ReadSafe |
---|---|
Category | Behavior |
Loaded/Saved | true |
History 1
- 514 Add SecondaryAlias
Triggered
Parameters (2) | |
---|---|
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 "/{TextChatCommand.PrimaryAlias}" or "/{TextChatCommand.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.
Thread safety | Unsafe |
---|