Chat profanity filters
Overview
A chat profanity filter is a system designed to automatically detect and filter out inappropriate language and content from user-generated text within chat applications. The implementation of a profanity filter is crucial for maintaining a positive and respectful user experience, preventing offensive content, and complying with community guidelines. Profanity can include explicit language, hate speech, and other forms of offensive content. The filter is capable of recognizing and handling various types of inappropriate language. The figure below shows how the chat profanity filter works:
This article provides information on how to manage your profanity filter.
Prerequisites
Permissions | Action | Usage |
---|---|---|
ADMIN:NAMESPACE:*:CHAT:PROFANITY | CREATE , READ , UPDATE , DELETE | To register, query, update and delete profanity word. |
Manage chat profanity filters
Log in to the AccelByte Gaming Services (AGS) Admin Portal.
Navigate to the game namespace for which you want to add a chat profanity filter.
On the sidebar, go to Social > Chat > Chat Profanity Filter. If no words have been added yet, the page is blank and the chat profanity filter's status is inactive.
Click + Register Profanity, then enter the following details:
- Profanity: Enter a word that you want to be filtered.
- False Negative: Add list of words that contains the default profanity word and will be censored when used (e.g., profanity word
ass
, false negativeasshole
). - False Positive: Add list of words that contains the default profanity word and will not be censored when used (e.g., profanity word
ass
, false positivemass
).
Click Save.
User-specific profanity configuration
To give your players the option to enable or disable the profanity filter for their game accounts, use this code:
- Unreal Engine
- OSS
FAccelByteModelsSetUserChatConfigurationRequest UserChatConfiguration;
UserChatConfiguration.Config.ProfanityDisabled = true; // Set true to disable profanity for current user
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
ApiClient->Chat.SetUserChatConfiguration(UserChatConfiguration
, AccelByte::Api::Chat::FSetUserChatConfigurationResponse::CreateLambda(
[&](const FAccelByteSetUserChatConfigurationResponse& Response)
{
UE_LOG(LogTemp, Log, TEXT("Set user chat configuration success."))
}), FErrorHandler::CreateLambda(
[&](int32 ErrorCode, const FString& ErrorMessage)
{
UE_LOG(LogTemp, Log, TEXT("Set user chat configuration failed. ErrorCode: %d, ErrorMessage: %s"), ErrorCode, *ErrorMessage)
}));
int32 UserNum = 0;
FOnlineChatAccelBytePtr ChatInterface;
FOnlineChatAccelByte::GetFromWorld(GetWorld(), ChatInterface);
FAccelByteModelsSetUserChatConfigurationRequest UserChatConfiguration;
UserChatConfiguration.Config.ProfanityDisabled = true; // Set true to disable profanity for current user
// Listen to delegate for set user chat configuration complete
ChatInterface->AddOnSetUserChatConfigurationCompleteDelegate_Handle(UserNum
, FOnSetUserChatConfigurationCompleteDelegate::CreateLambda(
[&](const int32 LocalUserNum, const FAccelByteSetUserChatConfigurationResponse& UserChatConfiguration, const FOnlineError& ErrorInfo)
{
if (LocalUserNum == UserNum)
{
if (ErrorInfo.bSucceeded)
{
UE_LOG(LogTemp, Log, TEXT("Set user chat configuration success."))
}
else
{
UE_LOG(LogTemp, Log, TEXT("Set user chat configuration failed. ErrorCode: %s, ErrorMessage: %s"), *ErrorInfo.ErrorCode, *ErrorInfo.ErrorRaw)
}
}
}));
ChatInterface->SetUserConfiguration(UserNum, UserChatConfiguration);