Hello Developers and internet users!
We are making a change to the text filter API to help us improve the quality of our text filtering!
However we need your help and cooperation! We have added new api members to our text filtering functions which will identify chat as either public or private when you are filtering it.
These changes only affect our lovely TextService method
:FilterStringAsync. Going forward this function will accept three parameters instead of two.
Here’s how FilterStringAsync looks today:
TextFilterResult FilterStringAsync ( string stringToFilter, int64 fromUserId, TextFilterContext textContext = PrivateChat )
You’ll notice that the third argument here is optional. This means there is no need for panic! If you are unable to add this parameter right away, our default value will take care of everything!
How will this affect my game?
If you are using the standard chat system, you do not need to do anything! The Roblox default chat system has been updated to automatically include these changes.
If you have modified the chat system, you may update any calls to TextService:FilterStringAsync to include an optional third parameter,
Enum.TextFilterContext. The allowed values for this parameter are
Enum.TextFilterContext.PrivateChat (as appropriate for the type of chat).
"Which files should I edit if I have forked Roblox's default chat and I want to make these changes?"
I only had to change two files to bring things up to code. ChatService had one function I looked at which was
InternalApplyRobloxFilterNewAPIand ChatChannel had two functions I looked at which were
InternalApplyRobloxFilter. Good luck!
Hint: If you have simply modified the default Roblox in game chat scripts, you’ll want to leverage ChatChannel’s
Privatefield to determine which Enum to send to TextService. That’ll do the trick!
What qualifies as private text?
Private text is anything that is seen only by specific players, rather than every player. For example, if the speaker’s expectation is that the chat will only be seen by a single player, or by a selected group of players, then the chat is considered private. Chat for teams or chat that is potentially visible to a wider group, such as the server and its inhabitants, is considered public.
If you are unsure what your text qualifies as, please leave the optional field blank. Easy!
What if I do not use TextService?
If you are not using TextService to filter your user’s text input, then I hope you are at least using ChatService’s methods! (I would recommend using TextService’s api in the future as it is much nicer and ergonomic!)
However if you currently have legacy content that utilizes ChatService’s filtering methods, never fret! These methods will currently default to appropriate values and do not require any changes at this time.
These changes have already been documented by our wonderful Information Experience team!
Find out more about this API on our Developer Portal at http://wiki.roblox.com/index.php?title=API:Class/TextService/FilterStringAsync
Bear in mind, while text filtering may seem daunting, these changes were made with developers (yes, you!) in mind.
Feel free to ask questions about these changes or the impact they may have on your games.