TextChatMessage

顯示已棄用項目

*此內容是使用 AI(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.Info</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>班級團隊</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.Target不存在</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.Unknown</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.AnimationPlaying</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.多個匹配</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.PrefixText 是指與 TextSource 通過 Player.DisplayName 相關的使用者的名稱,這是 TextSourceTextSource.UserId

平行讀取

指示 TextChatMessage 的狀態。

Text

平行讀取

對使用者的過濾文字訊息。不同的使用者可以根據過濾規則從此屬性收到不同的字串。它可以是空字串。

TextChannel

平行讀取

參考來源 TextChannel

TextSource

平行讀取

參考來源 TextSource

Timestamp

平行讀取

訊息最初傳送時的時戳。

Translation

平行讀取

代表基於使用者本地化設定翻譯和過濾的文字訊息。系統不會翻譯具有相同本地化設定或使用無文字過濾協助持的用戶之間的訊息,因此此屬性可能是空字串,如果沒有翻譯發生,就不會發生。若要自訂,請參閱 自訂翻譯訊息

方法

活動