The Profanity Filter Block lets you run real-time moderation on chat messages as they go over the PubNub Data Stream Network. The block detects bad words, swear words, and profanity in any given text, and lets you censor the content in a variety of different ways. Whenever a user publishes messages, the block processes the text for profanity, and either blocks the publishing of the post, or sensors the specific words.
Profanity Filter Block is triggered before a message is published on a channel. It checks the contents of the message against a dictionary of swear words and allows you to either replace a part of the text with special characters or completely block the message.
After a certain number of violations, you can also block the user's IP address entirely by keeping track of sender details and checking against violations on each publish.
Set the channel to
* in the Functions editor to moderate chat messages on all channels across your app's key set.
Publish a message text on any channel. Include profanity in the text and see the output message with the profanity filtered.