TextChannel

Mostrar obsoleto

Represents a text chat channel. Contains TextSources as descendants.

To send a chat message to the TextChannel, call TextChannel:SendAsync() from a LocalScript. The corresponding TextSource of the user with TextSource.CanSend = true must be in that channel.

Messages from different TextChannels can be separated into different tabs in the chat window using ChannelTabsConfiguration.

To learn more, see In-Experience Text Chat.

Resumen

Métodos

Eventos

Propiedades

Métodos

DisplaySystemMessage

Displays a system message to user. Can only be used in a LocalScript, or in a Script with RunContext of Enum.RunContext.Client. Messages are only visible to that user and aren't automatically filtered or localized.

Parámetros

systemMessage: string

The system message sent to the TextChannel.

metadata: string

Use to identify system message types, such as the default system messages.

Valor predeterminado: ""

Devuelve

A TextChatMessage with TextChatMessage.Status property that indicates the condition of the message.

AddUserAsync

Proporciona

Adds a TextSource to the TextChannel given userId of the user (with Player.UserId). Can only be used in a Script.

If a TextSource representing the user does not exist, this adds a TextSource.

If a TextSource representing the user does exist, this returns the TextSource.

If the user has chat off or isn't in the server, this returns a tuple nil, false.

Parámetros

userId: number

The userId of the Player.


Devuelve

Returns TextSource and true if a new TextSource is created for the user, TextSource and false if there is an existing TextSource, or nil and false if the user has chat off or is not in this server.

Proporciona

Sends a TextChatMessage to the server. Can only be used in a LocalScript, or in a Script with RunContext of Enum.RunContext.Client.

Parámetros

message: string

The message to send to the TextChannel.

metadata: string

Custom metadata to attach to the message.

Valor predeterminado: ""

Devuelve

A TextChatMessage with TextChatMessage.Status property that indicates the condition of the message.

Eventos

MessageReceived

Like TextChatService.MessageReceived, fires when TextChannel:DisplaySystemMessage() is invoked on the client, or when the client receives a valid TextChannel:SendAsync() response from the server. This event is only fired on the client.

If the server's TextChannel.ShouldDeliverCallback property is bound and returns false, the client will not fire TextChannel.MessageReceived.

Use the TextChatMessage parameter to get the TextSource and the text of the message (with TextChatMessage.Text).

The TextChatMessage parameter is the final result of any functions bound to TextChatService.OnIncomingMessage or TextChannel.OnIncomingMessage.

Parámetros

incomingMessage: TextChatMessage

The received TextChatMessage.


Llamadas

OnIncomingMessage

Parámetros


Devuelve

ShouldDeliverCallback

Parámetros

textSource: TextSource

Devuelve