Skip to main content

Filter Words Configuration

Apply filtering words configured in the console.

Console Filtering Configuration

Filtering Configuration

  1. Navigate to Console > Chat > Settings.
  2. Add words needed for filtering.
  3. Filter words must be separated by commas.
  4. Click the Save button.

Method Information

MethodDescription
FetchFilterWords()Fetch filter word list from server
Filter(const FString& Message, TCHAR Separator = TEXT('*'))Apply filter words to message

Parameters

Filter Method

ParameterTypeDescription
MessageFStringMessage to filter
SeparatorTCHARCharacter to replace filter words with (default: '*')

Code Example

void UMyGame::OnConnected()
{
UE_LOG(LogTemp, Log, TEXT("Chat Connected"));
// Fetch filter words on connection success
AChatManager::GetInstance()->FetchFilterWords();
AChatManager::GetInstance()->Subscribe(TEXT("CH01"));
}

void UMyGame::SendMessage(const FString& Channel, const FString& Message)
{
// Send message with filter words applied
FString FilteredMsg = AChatManager::GetInstance()->Filter(Message);
AChatManager::GetInstance()->SendPublicMessage(Channel, FilteredMsg);
}

void UMyGame::OnPublicMessage(const FChatUserInfo& Sender, const FString& Message)
{
// Apply filter words to received message
FString FilteredMsg = AChatManager::GetInstance()->Filter(Message);
UE_LOG(LogTemp, Log, TEXT("[%s] %s"), *Sender.visitorName, *FilteredMsg);
}

void UMyGame::OnPrivateMessage(const FChatUserInfo& Sender, const FString& Message)
{
// Apply filter words to whisper
FString FilteredMsg = AChatManager::GetInstance()->Filter(Message);
UE_LOG(LogTemp, Log, TEXT("[Whisper from %s] %s"), *Sender.visitorName, *FilteredMsg);
}

void UMyGame::OnNotifyMessage(const FChatUserInfo& Sender, const FString& Message)
{
FString FilteredMsg = AChatManager::GetInstance()->Filter(Message);
UE_LOG(LogTemp, Log, TEXT("[System] %s"), *FilteredMsg);
}