/[sudobot]/trunk/docs/app/(docs)/automoderation/moderation-rules/page.mdx
ViewVC logotype

Contents of /trunk/docs/app/(docs)/automoderation/moderation-rules/page.mdx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 626 - (show annotations)
Sat Sep 7 09:38:45 2024 UTC (6 months, 3 weeks ago) by rakinar2
File size: 24503 byte(s)
chore: sync with git

1 ---
2 title: Automatic Moderation Rules
3 short_name: Automatic Moderation Rules
4 ---
5
6 import Callout from "@/components/Alerts/Callout";
7 import { ConfigOption } from "@/components/MDX/ConfigOption";
8
9 # Automatic Moderation Rules
10
11 Automatic Moderation Rules, or Moderation Rules (or simply "rules"), are a set of rules that are used to automatically moderate messages and user profiles in your server. These rules are used to filter out messages and user profiles that violate the rules you've set up.
12
13 ## What are Moderation Rules and how do they work?
14
15 Moderation Rules are defined inside the guild-specific configuration file, and each rule may have an associated trigger condition and actions on trigger, alongside other behavior-controlling options.
16
17 Moderation Rules are **order-specific**, that means, the order in which the rules are defined in the configuration file matters. The first rule that matches the trigger condition will be executed, and the rest of the rules may or may not be ignored depending on the rule's configuration.
18
19 ## Configuring Moderation Rules
20
21 To configure Moderation Rules, you need to edit the guild-specific configuration file. The configuration file is located at `config/config.json`.
22 The object you should add/edit is `rule_moderation`. For example, a Moderation Rule configuration might look like this:
23
24 ```json
25 {
26 // This key is the Guild ID!
27 "847638624836373764": {
28 "rule_moderation": {
29 "enabled": true,
30 "rules": [
31 {
32 "type": "word_filter",
33 "words": ["word1", "word2"],
34 "actions": [{ "type": "delete_message" }]
35 },
36 {
37 "type": "regex_filter",
38 "patterns": ["disc(o|0)rd\\.gg"],
39 "actions": [{ "type": "delete_message" }]
40 }
41 ]
42 }
43 }
44 }
45 ```
46
47 We’ll explain the configuration options in the next section.
48
49 ## Rule Attributes
50
51 Each rule is an object defined inside the `rule_moderation.rules` array. The following attributes are available for each rule:
52
53 <ConfigOption
54 optionKey="rule.type"
55 type={
56 <ConfigOption.Types.Union>
57 <ConfigOption.Types.StringLiteral>
58 word_filter
59 </ConfigOption.Types.StringLiteral>
60 <ConfigOption.Types.StringLiteral>
61 regex_filter
62 </ConfigOption.Types.StringLiteral>
63 <ConfigOption.Types.StringLiteral>
64 anti_invite
65 </ConfigOption.Types.StringLiteral>
66 <ConfigOption.Types.StringLiteral>
67 domain_filter
68 </ConfigOption.Types.StringLiteral>
69 <ConfigOption.Types.StringLiteral>
70 mime_type_filter
71 </ConfigOption.Types.StringLiteral>
72 <ConfigOption.Types.StringLiteral>
73 file_extension_filter
74 </ConfigOption.Types.StringLiteral>
75 <ConfigOption.Types.StringLiteral>
76 repeated_text_filter
77 </ConfigOption.Types.StringLiteral>
78 <ConfigOption.Types.StringLiteral>
79 mass_mention_filter
80 </ConfigOption.Types.StringLiteral>
81 <ConfigOption.Types.StringLiteral>
82 image_filter
83 </ConfigOption.Types.StringLiteral>
84 <ConfigOption.Types.StringLiteral>
85 embed_filter
86 </ConfigOption.Types.StringLiteral>
87 <ConfigOption.Types.StringLiteral>
88 profile_filter
89 </ConfigOption.Types.StringLiteral>
90 <ConfigOption.Types.StringLiteral>
91 ai_scan
92 </ConfigOption.Types.StringLiteral>
93 <ConfigOption.Types.StringLiteral>
94 file_filter
95 </ConfigOption.Types.StringLiteral>
96 </ConfigOption.Types.Union>
97 }
98 >
99 The type of the rule.
100 </ConfigOption>
101
102 <ConfigOption optionKey="rule.name" type="string" optional>
103 The name of the rule. This is optional and is used for identification
104 purposes.
105 </ConfigOption>
106
107 <ConfigOption
108 optionKey="rule.enabled"
109 type="boolean"
110 optional
111 defaultValue="true"
112 >
113 Whether the rule is enabled or not. If this is set to `false`, the rule will
114 be ignored.
115 </ConfigOption>
116
117 <ConfigOption
118 optionKey="rule.mode"
119 type={
120 <ConfigOption.Types.Union>
121 <ConfigOption.Types.StringLiteral>
122 normal
123 </ConfigOption.Types.StringLiteral>
124 <ConfigOption.Types.StringLiteral>
125 inverse
126 </ConfigOption.Types.StringLiteral>
127 </ConfigOption.Types.Union>
128 }
129 optional
130 defaultValue={`"normal"`}
131 >
132 The mode of the rule. If set to `inverse`, the rule will be triggered when
133 the trigger condition is not met.
134 </ConfigOption>
135
136 <ConfigOption optionKey="rule.bail" type="boolean" optional defaultValue="true">
137 Whether to stop processing the rules after this rule is triggered. If this
138 is set to `false`, the next rule will be processed even if this rule is
139 triggered.
140 </ConfigOption>
141
142 <ConfigOption
143 optionKey="rule.actions"
144 type={
145 <ConfigOption.Types.ArrayLiteral>
146 <ConfigOption.Types.Identifier url="https://github.com/onesoft-sudo/sudobot/blob/main/src/main/typescript/schemas/ModerationActionSchema.ts#L9">
147 ModerationAction
148 </ConfigOption.Types.Identifier>
149 </ConfigOption.Types.ArrayLiteral>
150 }
151 >
152 An array of actions to perform when the rule is triggered. Each action is a
153 `ModerationAction` object.
154 </ConfigOption>
155
156 <ConfigOption
157 optionKey="rule.for"
158 optional
159 type={
160 <ConfigOption.Types.Identifier url="https://github.com/onesoft-sudo/sudobot/blob/main/src/main/typescript/schemas/MessageRuleSchema.ts#L28">
161 MessageRuleCondition
162 </ConfigOption.Types.Identifier>
163 }
164 >
165 The condition that must be met for the rule to be triggered. This is an
166 object that defines the condition.
167 </ConfigOption>
168
169 <ConfigOption
170 optionKey="rule.exceptions"
171 optional
172 type={
173 <ConfigOption.Types.Identifier url="https://github.com/onesoft-sudo/sudobot/blob/main/src/main/typescript/schemas/MessageRuleSchema.ts#L28">
174 MessageRuleCondition
175 </ConfigOption.Types.Identifier>
176 }
177 >
178 The condition that must be met for the rule to be ignored. This is an object
179 that defines the condition.
180 </ConfigOption>
181
182 <ConfigOption
183 optionKey="rule.is_bypasser"
184 optional
185 defaultValue="false"
186 type="boolean"
187 >
188 Whether this is a bypasser.
189 A bypasser is a special type of rule. When a bypasser matches, it will ignore specific rules as defined in the `bypasses` option.
190 </ConfigOption>
191
192 <ConfigOption
193 optionKey="rule.bypasses"
194 defaultValue="null"
195 type={
196 <ConfigOption.Types.Union>
197 <ConfigOption.Types.ArrayLiteral>
198 <ConfigOption.Types.Identifier>
199 string
200 </ConfigOption.Types.Identifier>
201 </ConfigOption.Types.ArrayLiteral>
202 <ConfigOption.Types.Null />
203 </ConfigOption.Types.Union>
204 }
205 >
206 An array of rule names that this rule bypasses.
207 This option is only used when `is_bypasser` is set to `true`.
208 </ConfigOption>
209
210 There might be additional attributes depending on the rule type.
211
212 ## Rule Types
213
214 ### Word Filter
215
216 The Word Filter rule type is used to filter messages based on specific words or tokens. The rule will trigger if any of the words in the `words` array are found or any of the tokens in the `tokens` array are found.
217
218 <Callout type="info">
219 Tokens are a way to match a word or a part of a word. For example, the token `word` will match `word`, `words`, `wording`, etc.
220 However, the token `word` will not match `w ord`, `wo rd`, etc.
221
222 A word is matched if it is surrounded by spaces or the beginning/end of the message. For example, the word `word` will match `word`, `word ing`, etc., but not `sword`, `wordy`, etc.
223 </Callout>
224
225 Example configuration for a Word Filter rule:
226
227 ```json
228 {
229 "type": "word_filter",
230 "words": ["word1", "word2"],
231 "tokens": ["token1", "token2"],
232 "actions": [
233 { "type": "warn", "reason": "Automatic: Posted a blocked word" },
234 { "type": "delete_message" },
235 ]
236 }
237 ```
238
239 **Options specific to Word Filter**
240
241 <ConfigOption
242 optionKey="rule.words"
243 optional
244 type={
245 <ConfigOption.Types.ArrayLiteral>
246 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
247 </ConfigOption.Types.ArrayLiteral>
248 }
249 >
250 An array of words to filter.
251 </ConfigOption>
252
253 <ConfigOption
254 optionKey="rule.tokens"
255 optional
256 type={
257 <ConfigOption.Types.ArrayLiteral>
258 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
259 </ConfigOption.Types.ArrayLiteral>
260 }
261 >
262 An array of tokens to filter.
263 </ConfigOption>
264
265 <ConfigOption
266 optionKey="rule.normalize"
267 defaultValue="true"
268 type="boolean"
269 >
270 Whether to normalize the words, tokens, and the message before filtering.
271 </ConfigOption>
272
273 ### Regex Filter
274
275 The Regex Filter rule type is used to filter messages based on regular expressions. The rule will trigger if any of the patterns in the `patterns` array are found.
276
277 Example configuration for a Regex Filter rule:
278
279 ```json
280 {
281 "type": "regex_filter",
282 "patterns": ["disc(o|0)rd\\.gg"],
283 "actions": [
284 { "type": "warn", "reason": "Automatic: Posted a Discord invite link" },
285 { "type": "delete_message" },
286 ]
287 }
288 ```
289
290 **Options specific to Regex Filter**
291
292 <ConfigOption
293 optionKey="rule.patterns"
294 type={
295 <ConfigOption.Types.Union>
296 <ConfigOption.Types.ArrayLiteral>
297 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
298 </ConfigOption.Types.ArrayLiteral>
299 <ConfigOption.Types.ArrayLiteral>
300 <ConfigOption.Types.TupleLiteral>
301 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
302 <ConfigOption.Types.Identifier>RegexFlagString</ConfigOption.Types.Identifier>
303 </ConfigOption.Types.TupleLiteral>
304 </ConfigOption.Types.ArrayLiteral>
305 </ConfigOption.Types.Union>
306 }
307 >
308 An array of regular expressions to filter.
309 A `RegexFlagString` is a string that contains the flags for the regular expression, supported by JavaScript.
310 </ConfigOption>
311
312 ### Anti-Invite
313
314 The Anti-Invite rule type is used to filter messages that contain invite links. The rule will trigger if an invite link is found in the message.
315
316 Example configuration for an Anti-Invite rule:
317
318 ```json
319 {
320 "type": "anti_invite",
321 "actions": [
322 { "type": "warn", "reason": "Automatic: Posted a Discord invite link" },
323 { "type": "delete_message" },
324 ]
325 }
326 ```
327
328 **Options specific to Anti-Invite**
329
330
331 <ConfigOption
332 optionKey="rule.allowed_invite_codes"
333 defaultValue="[]"
334 type={
335 <ConfigOption.Types.ArrayLiteral>
336 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
337 </ConfigOption.Types.ArrayLiteral>
338 }
339 >
340 An array of invite codes that are allowed.
341 </ConfigOption>
342
343 <ConfigOption
344 optionKey="rule.allow_internal_invites"
345 defaultValue="true"
346 type="boolean"
347 >
348 Whether to allow internal server invites.
349 </ConfigOption>
350
351 ### Domain Filter
352
353 The Domain Filter rule type is used to filter messages that contain URLs with specific domains. The rule will trigger if a URL with a domain in the `domains` array is found in the message.
354
355 Example configuration for a Domain Filter rule:
356
357 ```json
358 {
359 "type": "domain_filter",
360 "domains": ["example.com", "example.org"],
361 "actions": [
362 { "type": "warn", "reason": "Automatic: Posted a blocked domain" },
363 { "type": "delete_message" },
364 ]
365 }
366 ```
367
368 **Options specific to Domain Filter**
369
370 <ConfigOption
371 optionKey="rule.domains"
372 type={
373 <ConfigOption.Types.ArrayLiteral>
374 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
375 </ConfigOption.Types.ArrayLiteral>
376 }
377 >
378 An array of domains to filter.
379 </ConfigOption>
380
381 <ConfigOption
382 optionKey="rule.scan_links_only"
383 defaultValue="false"
384 type="boolean"
385 >
386 Whether to scan only the links in the message.
387 </ConfigOption>
388
389 ### MIME Type Filter
390
391 The MIME Type Filter rule type is used to filter messages that contain attachments with specific MIME types. The rule will trigger if an attachment with a MIME type in the `mime_types` array is found in the message.
392
393 Example configuration for a MIME Type Filter rule:
394
395 ```json
396 {
397 "type": "mime_type_filter",
398 "data": ["image/png", "image/jpeg"],
399 "actions": [
400 { "type": "warn", "reason": "Automatic: Posted a file that is not allowed" },
401 { "type": "delete_message" },
402 ]
403 }
404 ```
405
406 **Options specific to MIME Type Filter**
407
408 <ConfigOption
409 optionKey="rule.data"
410 type={
411 <ConfigOption.Types.ArrayLiteral>
412 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
413 </ConfigOption.Types.ArrayLiteral>
414 }
415 >
416 An array of MIME types to filter.
417 </ConfigOption>
418
419 ### File Extension Filter
420
421 The File Extension Filter rule type is used to filter messages that contain attachments with specific file extensions. The rule will trigger if an attachment with a file extension in the `extensions` array is found in the message.
422
423 Example configuration for a File Extension Filter rule:
424
425 ```json
426 {
427 "type": "file_extension_filter",
428 "data": ["png", "jpg"],
429 "actions": [
430 { "type": "warn", "reason": "Automatic: Posted a file that is not allowed" },
431 { "type": "delete_message" },
432 ]
433 }
434 ```
435
436 **Options specific to File Extension Filter**
437
438 <ConfigOption
439 optionKey="rule.data"
440 type={
441 <ConfigOption.Types.ArrayLiteral>
442 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
443 </ConfigOption.Types.ArrayLiteral>
444 }
445 >
446 An array of file extensions to filter.
447 </ConfigOption>
448
449 ### Repeated Text Filter
450
451 The Repeated Text Filter rule type is used to filter messages that contain repeated text. The rule will trigger if the message contains repeated text.
452
453 Example configuration for a Repeated Text Filter rule:
454
455 ```json
456 {
457 "type": "repeated_text_filter",
458 "actions": [
459 { "type": "warn", "reason": "Automatic: Posted repeated text" },
460 { "type": "delete_message" },
461 ]
462 }
463 ```
464
465 **Options specific to Repeated Text Filter**
466
467 <ConfigOption
468 optionKey="rule.max_repeated_chars"
469 defaultValue="20"
470 type="number"
471 >
472 The maximum number of repeated characters allowed in the message.
473 </ConfigOption>
474
475 <ConfigOption
476 optionKey="rule.max_repeated_words"
477 defaultValue="15"
478 type="number"
479 >
480 The maximum number of repeated words allowed in the message.
481 </ConfigOption>
482
483 ### Mass Mention Filter
484
485 The Mass Mention Filter rule type is used to filter messages that contain mass mentions. The rule will trigger if the message contains mass mentions.
486
487 Example configuration for a Mass Mention Filter rule:
488
489 ```json
490 {
491 "type": "mass_mention_filter",
492 "actions": [
493 { "type": "warn", "reason": "Automatic: Posted mass mentions" },
494 { "type": "delete_message" },
495 ]
496 }
497 ```
498
499 **Options specific to Mass Mention Filter**
500
501 <ConfigOption
502 optionKey="rule.max_mentions"
503 defaultValue="15"
504 type="number"
505 >
506 The maximum number of mentions allowed in the message.
507 </ConfigOption>
508
509
510 <ConfigOption
511 optionKey="rule.max_user_mentions"
512 defaultValue="-1"
513 type="number"
514 >
515 The maximum number of user mentions allowed in the message. `-1` means no limit.
516 </ConfigOption>
517
518 <ConfigOption
519 optionKey="rule.max_role_mentions"
520 defaultValue="-1"
521 type="number"
522 >
523 The maximum number of role mentions allowed in the message. `-1` means no limit.
524 </ConfigOption>
525
526 ### Image Filter
527
528 The Image Filter rule type is used to filter messages that contain images. The rule will trigger if the message contains images that have text with specific words or tokens.
529
530 Example configuration for an Image Filter rule:
531
532 ```json
533 {
534 "type": "image_filter",
535 "words": ["word1", "word2"],
536 "tokens": ["token1", "token2"],
537 "actions": [
538 { "type": "warn", "reason": "Automatic: Posted an image with blocked text" },
539 { "type": "delete_message" },
540 ]
541 }
542 ```
543
544 **Options specific to Image Filter**
545
546 <ConfigOption
547 optionKey="rule.words"
548 optional
549 type={
550 <ConfigOption.Types.ArrayLiteral>
551 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
552 </ConfigOption.Types.ArrayLiteral>
553 }
554 >
555 An array of words to filter in the image.
556 </ConfigOption>
557
558 <ConfigOption
559 optionKey="rule.tokens"
560 optional
561 type={
562 <ConfigOption.Types.ArrayLiteral>
563 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
564 </ConfigOption.Types.ArrayLiteral>
565 }
566 >
567 An array of tokens to filter in the image.
568 </ConfigOption>
569
570 <ConfigOption
571 optionKey="rule.inherit_from_word_filter"
572 defaultValue="false"
573 type="boolean"
574 >
575 Whether to inherit the words and tokens from the first Word Filter rule.
576 </ConfigOption>
577
578 <ConfigOption
579 optionKey="rule.scan_embeds"
580 defaultValue="false"
581 type="boolean"
582 >
583 Whether to scan images inside embeds in the message.
584 </ConfigOption>
585
586 ### Embed Filter
587
588 The Embed Filter rule type is used to filter messages that contain embeds. The rule will trigger if the message contains embeds with specific words or tokens.
589
590 Example configuration for an Embed Filter rule:
591
592 ```json
593 {
594 "type": "embed_filter",
595 "words": ["word1", "word2"],
596 "tokens": ["token1", "token2"],
597 "actions": [
598 { "type": "warn", "reason": "Automatic: Posted an embed with blocked text" },
599 { "type": "delete_message" },
600 ]
601 }
602 ```
603
604 **Options specific to Embed Filter**
605
606 <ConfigOption
607 optionKey="rule.words"
608 optional
609 type={
610 <ConfigOption.Types.ArrayLiteral>
611 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
612 </ConfigOption.Types.ArrayLiteral>
613 }
614 >
615 An array of words to filter in the embeds.
616 </ConfigOption>
617
618 <ConfigOption
619 optionKey="rule.tokens"
620 optional
621 type={
622 <ConfigOption.Types.ArrayLiteral>
623 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
624 </ConfigOption.Types.ArrayLiteral>
625 }
626 >
627 An array of tokens to filter in the embeds.
628 </ConfigOption>
629
630 <ConfigOption
631 optionKey="rule.inherit_from_word_filter"
632 defaultValue="false"
633 type="boolean"
634 >
635 Whether to inherit the words and tokens from the first Word Filter rule.
636 </ConfigOption>
637
638 ### Profile Filter
639
640 The Profile Filter rule type is used to filter user profiles based on specific conditions. The rule will trigger if the user profile contains specific words or tokens, or matches specific regular expressions.
641
642 Example configuration for a Profile Filter rule:
643
644 ```json
645 {
646 "type": "profile_filter",
647 "words": ["word1", "word2"],
648 "tokens": ["token1", "token2"],
649 "regex_patterns": ["disc(o|0)rd\\.gg"],
650 "actions": [
651 { "type": "warn", "reason": "Automatic: Profile contains blocked text" },
652 { "type": "kick" },
653 ]
654 }
655 ```
656 **Options specific to Profile Filter**
657
658 <ConfigOption
659 optionKey="rule.words"
660 optional
661 type={
662 <ConfigOption.Types.ArrayLiteral>
663 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
664 </ConfigOption.Types.ArrayLiteral>
665 }
666 >
667 An array of words to filter in the user profile.
668 </ConfigOption>
669
670 <ConfigOption
671 optionKey="rule.tokens"
672 optional
673 type={
674 <ConfigOption.Types.ArrayLiteral>
675 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
676 </ConfigOption.Types.ArrayLiteral>
677 }
678 >
679 An array of tokens to filter in the user profile.
680 </ConfigOption>
681
682 <ConfigOption
683 optionKey="rule.regex_patterns"
684 optional
685 type={
686 <ConfigOption.Types.ArrayLiteral>
687 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
688 </ConfigOption.Types.ArrayLiteral>
689 }
690 >
691 An array of regular expressions to filter in the user profile.
692 </ConfigOption>
693
694 <ConfigOption
695 optionKey="rule.normalize"
696 defaultValue="true"
697 type="boolean"
698 >
699 Whether to normalize the words, tokens, and the user profile texts before filtering.
700 </ConfigOption>
701
702 ### AI Scan
703
704 The AI Scan rule type is used to scan messages using AI. The rule will trigger if the AI detects specific content in the message.
705
706 Example configuration for an AI Scan rule:
707
708 ```json
709 {
710 "type": "ai_scan",
711 "actions": [
712 { "type": "warn", "reason": "Automatic: Detected inappropriate content" },
713 { "type": "delete_message" },
714 ]
715 }
716 ```
717
718 **Options specific to AI Scan**
719
720 <ConfigOption
721 optionKey="rule.toxicity_threshold"
722 defaultValue="0.5"
723 type="number"
724 >
725 The toxicity threshold for the AI scan. If the toxicity score of the message is greater than or equal to this threshold, the rule will trigger.
726 </ConfigOption>
727
728 <ConfigOption
729 optionKey="rule.identity_attack_threshold"
730 defaultValue="0.5"
731 type="number"
732 >
733 The identity attack threshold for the AI scan. If the identity attack score of the message is greater than or equal to this threshold, the rule will trigger.
734 </ConfigOption>
735
736 <ConfigOption
737 optionKey="rule.insult_threshold"
738 defaultValue="0.5"
739 type="number"
740 >
741 The insult threshold for the AI scan. If the insult score of the message is greater than or equal to this threshold, the rule will trigger.
742 </ConfigOption>
743
744 <ConfigOption
745 optionKey="rule.profanity_threshold"
746 defaultValue="0.5"
747 type="number"
748 >
749 The profanity threshold for the AI scan. If the profanity score of the message is greater than or equal to this threshold, the rule will trigger.
750 </ConfigOption>
751
752 <ConfigOption
753 optionKey="rule.threat_threshold"
754 defaultValue="0.5"
755 type="number"
756 >
757 The threat threshold for the AI scan. If the threat score of the message is greater than or equal to this threshold, the rule will trigger.
758 </ConfigOption>
759
760 <ConfigOption
761 optionKey="rule.sexually_explicit_threshold"
762 defaultValue="0.5"
763 type="number"
764 >
765 The sexually explicit threshold for the AI scan. If the sexually explicit score of the message is greater than or equal to this threshold, the rule will trigger.
766 </ConfigOption>
767
768 <ConfigOption
769 optionKey="rule.flirtation_threshold"
770 defaultValue="0.5"
771 type="number"
772 >
773 The flirtation threshold for the AI scan. If the flirtation score of the message is greater than or equal to this threshold, the rule will trigger.
774 </ConfigOption>
775
776 ### File Filter
777
778 The File Filter rule type is used to filter messages that contain files. The rule will trigger if the message contains files with a blocked hash.
779
780 Example configuration for a File Filter rule:
781
782 ```json
783 {
784 "type": "file_filter",
785 "hashes": { "d3d0bfbe67707d003ab937212ee96309b7f7beb6871391064917b70c20fa5a67": "image/png" },
786 "check_mime_types": false,
787 "actions": [
788 { "type": "warn", "reason": "Automatic: Posted a file that is not allowed" },
789 { "type": "delete_message" },
790 ]
791 }
792 ```
793
794 **Options specific to File Filter**
795
796 <ConfigOption
797 optionKey="rule.hashes"
798 type={
799 <ConfigOption.Types.GenericIdentifier genericTypes={[
800 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>,
801 <ConfigOption.Types.Union>
802 <ConfigOption.Types.Identifier>string</ConfigOption.Types.Identifier>
803 <ConfigOption.Types.Null />
804 </ConfigOption.Types.Union>
805 ]}>
806 Record
807 </ConfigOption.Types.GenericIdentifier>
808 }
809 >
810 A record of file hashes to filter. The key is the hash and the value is the MIME type of the file. If the MIME type is `null`, the MIME type will not be checked.
811 </ConfigOption>
812
813 <ConfigOption
814 optionKey="rule.check_mime_types"
815 defaultValue="false"
816 type="boolean"
817 >
818 Whether to check the MIME types of the files.
819 </ConfigOption>
820
821 <Callout type="info">
822 Documentation of the experimental rules might not be included here at this time. Please refer to the source code for more information.
823 </Callout>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26