Skip to main content

Profanity filter callback

By default, the message sender is not notified when a message is blocked by moderation.

Messages may be blocked when:

  • Text content matches a built-in profanity word (message not delivered).
  • Text content matches a custom profanity word set to block (message not delivered).
  • Message is blocked by a pre-messaging webhook rule.

Set a blocked message listener

Register a listener

Dart
NCEngine.addMessageHandler(
'my_block_listener',
MessageHandler(
onMessageBlocked: (BlockedMessageInfo? info) {
if (info != null) {
// Handle blocked message
}
},
),
);

Remove a listener

Dart
NCEngine.removeMessageHandler('my_block_listener');

BlockedMessageInfo properties

PropertyTypeDescription
channelTypeChannelType?Channel type
channelIdString?Channel ID
blockedMsgUIdString?Unique ID of the blocked message
blockTypeMessageBlockType?Block reason
extraString?Additional info

MessageBlockType values

EnumDescription
unknownUnknown reason
globalGlobal profanity filter
customCustom profanity filter
thirdPartyThird-party moderation service