type ProfanityCheckConfig = { checkManualProfanityList: boolean; provider: string; }; declare class Filter { list: string[]; exclude: string[]; splitRegex: RegExp; placeHolder: string; regex: RegExp; replaceRegex: RegExp; openModeratorAPIKey: string | undefined; /** * Filter constructor. To use AI functions must set in .env or pass as param: OPEN_MODERATOR_API_KEY * @constructor * @param {object} options - Filter instance options * @param {boolean} options.emptyList - Instantiate filter with no blacklist * @param {array} options.list - Instantiate filter with a custom list * @param {string} options.placeHolder - Character used to replace profane words. * @param {string} options.regex - Regular expression used to sanitize words before comparing them to the blacklist. * @param {string} options.replaceRegex - Regular expression used to replace profane words with placeHolder. * @param {string} options.splitRegex - Regular expression used to split a string into words. * @param {string} options.contentCheckerAPIKey - API key for OpenModerator API */ constructor(options?: { emptyList?: boolean; list?: string[]; exclude?: string[]; placeHolder?: string; regex?: RegExp; replaceRegex?: RegExp; splitRegex?: RegExp; openModeratorAPIKey?: string; }); /** * Determine if a string contains profane language. * @param {string} string - String to evaluate for profanity. */ isProfane(string: string): boolean; /** * Replace a word with placeHolder characters; * @param {string} string - String to replace. */ replaceWord(string: string): string; /** * Evaluate a string for profanity and return an edited version. * @param {string} string - Sentence to filter. */ clean(string: string): string; /** * Add word(s) to blacklist filter / remove words from whitelist filter * @param {...string} words - Word(s) to add to the blacklist */ addWords(...words: string[]): void; /** * Add words to whitelist filter * @param {...string} words - Word(s) to add to the whitelist. */ removeWords(...words: string[]): void; /** * AI-enabled way to determine if a string contains profane language. Ensure that you've set an API key for OpenModerator * @param {string} str - String to evaluate for profanity. * @param {ProfanityCheckConfig} config - Configuration object containing checkManualProfanityList and provider. * In config: provider can be "openai" (OpenAI's Moderation API) or "google-perspective-api" (Google's Perspective API) or "google-natural-language-api" (Google's Natural Language API) * In config: checkManualProfanityList is a boolean to determine if the manual profanity list in lang.ts should be checked first. * @returns {Promise<{ profane: boolean; type: string[] }>} - Object containing profane flag and types of detected content ("PROFANITY") */ isProfaneAI(str: string, config?: ProfanityCheckConfig): Promise<{ profane: boolean; type: string[]; }>; /** * AI-enabled way to determine if an image contains NSFW content. * Ensure that you've set an API key for OpenModerator. * @param {Blob} image - Image file (jpg, png) to evaluate for NSFW content. * @returns {Promise<{ nsfw: boolean; types: string[] }>} - Object containing NSFW flag and types of detected content ("Hentai" or "Porn") */ isImageNSFW(image: Blob): Promise<{ nsfw: boolean; types: string[]; }>; } export { Filter };