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.
{ "text": "profanity message here" }
{ "text": "**** message here" }
Need help? Contact PubNub Support.
Copyright (c) 2018 PubNub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.