TextChatMessage

显示已弃用

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

无法创建

不可更改的数据对象,用于表示文字聊天消信息。

要了解有关使用 TextChatMessages 的更多信息,请参阅 体验内文字聊天

概要

属性

属性

BubbleChatMessageProperties

读取并联

ChatWindowMessageProperties

读取并联

MessageId

读取并联

TextChatMessage的独一标识符。

Metadata

读取并联

用于存储有关 TextChatMessage 的杂项数据的通用领域。TextChannel:SendAsync()TextChannel:DisplaySystemMessage() 的第二个参数用于填充此字段。

使用此字段来在 TextChatService.OnIncomingMessageTextChannel.OnIncomingMessage 回调中应用额外的格式化对特殊消息。


local TextChatService = game:GetService("TextChatService")
local generalChannel: TextChannel = TextChatService:WaitForChild("TextChannels").RBXGeneral
generalChannel:DisplaySystemMessage("This is an error!", "Game.Error.Generic")
generalChannel:DisplaySystemMessage("Could not find save data!", "Game.Error.SaveDataNotFound")
generalChannel:DisplaySystemMessage("You won the game!", "Game.Info.Win")
generalChannel:DisplaySystemMessage("You lost the game!", "Game.Info.Lose")
generalChannel.OnIncomingMessage = function(message: TextChatMessage)
if string.find(message.Metadata, "Error") then
local overrideProperties = Instance.new("TextChatMessageProperties")
overrideProperties.TextColor = Color3.fromRGB(255, 0, 0)
return overrideProperties
elseif string.find(message.Metadata, "Info") then
local overrideProperties = Instance.new("TextChatMessageProperties")
overrideProperties.TextColor = Color3.fromRGB(0, 255, 150)
return overrideProperties
end
return nil
end

如下是聊天系统发出的默认系统消息的参考:


<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Roblox.ChatTranslation.ChatWindow.SystemMessage</code></td>
<td>表示系统可能会为玩家翻译聊天消息。</td>
</tr>
<tr>
<td><code>Roblox.Notification.Friend.加入</code></td>
<td>当玩家的朋友之一加入体验时显示。</td>
</tr>
<tr>
<td><code>Roblox.MessageStatus.警告arning.Floodchecked</code></td>
<td>当玩家发送消息时,服务器限制了消息速率时显示。</td>
</tr>
<tr>
<td><code>Roblox.MessageStatus.警告arning.TextFilter失败</code></td>
<td>当玩家发送的消息由于文本过滤问题无法显示时显示。</td>
</tr>
<tr>
<td><code>Roblox.MessageStatus.警告arning.InvalidPrivacySettings</code></td>
<td>当玩家的隐私设置阻止他们发送消信息时显示。</td>
</tr>
<tr>
<td><code>Roblox.MessageStatus.警告arning.Message太长</code></td>
<td>当玩家发送含有过长内容的消息时显示。</td>
</tr>
<tr>
<td><code>Roblox.MessageStatus.警告arning.Unknown</code></td>
<td>显示系统因未知原因无法发送玩家的消息时。</td>
</tr>
<tr>
<td><code>Roblox.Help.Info</code></td>
<td>显示来自 <code>RBXHelpCommand</code><code>Class.TextChatCommand</code> 的响应。</td>
</tr>
<tr>
<td><code>Roblox.Version.信息</code></td>
<td>显示来自 <code>RBXVersionCommand</code><code>Class.TextChatCommand</code> 的响应。</td>
</tr>
<tr>
<td><code>Roblox.Team.Success.NowInTeam</code></td>
<td>当玩家的团队发生变更时显示。</td>
</tr>
<tr>
<td><code>Roblox.Team.Error.不能团队聊天,如果不在团队中</code></td>
<td>当玩家触发 <code>RBX团队命令</code><code>Class.TextChatCommand</code> 而不在 <code>Class.Team</code> 上时显示。</td>
</tr>
<tr>
<td><code>Roblox.Whisper.Info.成功</code></td>
<td>当玩家成功启动悄悄话聊天时显示。</td>
</tr>
<tr>
<td><code>Roblox.Whisper.Welcome.Sent</code></td>
<td>当输入悄悄话 <code>Class.TextChannel</code> 时显示。</td>
</tr>
<tr>
<td><code>Roblox.Whisper.Error.不能向自己喃喃</code></td>
<td>来自 <code>RBXWhisperCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Whisper.Error.TargetDoesNotExist</code></td>
<td>来自 <code>RBXWhisperCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Whisper.Error.TooManyMatches</code></td>
<td>来自 <code>RBXWhisperCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Whisper.Error.未知</code></td>
<td>来自 <code>RBXWhisperCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Emote.Error.不存在</code></td>
<td>来自 <code>RBXEmoteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Emote.Error.UserEmotesNotEnabled</code></td>
<td>来自 <code>RBXEmoteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Emote.Error.暂时不可用</code></td>
<td>来自 <code>RBXEmoteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Emote.Error.不支持</code></td>
<td>来自 <code>RBXEmoteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Emote.Error.SwitchToR15</code></td>
<td>来自 <code>RBXEmoteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Emote.Error.动画播放</code></td>
<td>来自 <code>RBXEmoteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Mute.Error.PlayerNotFound</code></td>
<td>来自 <code>RBXMuteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Mute.Error.MultipleMatches</code></td>
<td>来自 <code>RBXMuteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Mute.Error.不能静音自己</code></td>
<td>来自 <code>RBXMuteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Mute.Info.成功</code></td>
<td>来自 <code>RBXMuteCommand</code><code>Class.TextChatCommand</code> 的成功回应。</td>
</tr>
<tr>
<td><code>Roblox.Unmute.Error.PlayerNotFound</code></td>
<td>来自 <code>RBXUnmuteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Unmute.Error.MultipleMatches</code></td>
<td>来自 <code>RBXUnmuteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Unmute.Error.CannotMuteSelf</code></td>
<td>来自 <code>RBXUnmuteCommand</code><code>Class.TextChatCommand</code> 的错误响应。</td>
</tr>
<tr>
<td><code>Roblox.Unmute.Info.成功</code></td>
<td>来自 <code>RBXUnmuteCommand</code><code>Class.TextChatCommand</code> 的成功回应。</td>
</tr>
</tbody>
元数据

PrefixText

读取并联

用于添加到用户的消信息的前缀。这支持富文本,因此开发人员可以为这段文本设置自定义属性,以支持聊天标签。

默认情况下, 是指与 通过 相关的用户的名称,这是 通过 的 。

读取并联

指示 TextChatMessage 的状态。

Text

读取并联

用户的过滤文本消息。不同的用户可以根据过滤规则从此属性中收到不同的字符串。它可以是空的字符串。

TextChannel

读取并联

对起源的参考 TextChannel .

TextSource

读取并联

对起源的参考 TextSource .

Timestamp

读取并联

消息最初发送时的时戳。

Translation

读取并联

代表基于用户本地化设置翻译和过滤的文本消息。系统不会翻译具有相同本地化设置的用户之间的消息或使用没有文本过滤协助持的语言的用户之间的消息,因此此属性可能是空的字符串,如果没有翻译发生,就不会发生。有关自定义,请参阅自定义翻译消息

方法

活动