Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/onesoft-sudo/sudobot/llms.txt

Use this file to discover all available pages before exploring further.

Moderation Rules are a declarative filtering system that lets you define conditions SudoBot checks against every incoming message or user profile, and specify what actions the bot takes when a condition is met. Rules are evaluated in order, and the first matching rule wins by default.

How rules work

Rules live in the rule_moderation object inside your guild’s entry in config/config.json. Each rule in the rules array is an object with at least a type and an actions field.
{
  "YOUR_GUILD_ID": {
    "rule_moderation": {
      "enabled": true,
      "rules": [
        {
          "type": "word_filter",
          "words": ["badword"],
          "actions": [{ "type": "delete_message" }]
        }
      ]
    }
  }
}
Rules are order-sensitive. The first rule whose condition matches is executed. Subsequent rules are skipped unless the triggered rule has "bail": false.

Common rule attributes

Every rule, regardless of type, supports the following attributes:
AttributeTypeDefaultDescription
typestringThe rule type (required). See Rule types below.
namestringOptional identifier used in bypass references.
enabledbooleantrueSet to false to skip this rule without removing it.
mode"normal" | "inverse""normal"In inverse mode the rule triggers when its condition is not met.
bailbooleantrueWhen true, stops processing subsequent rules after this one fires.
actionsModerationAction[]Actions to take when the rule triggers (required).
forMessageRuleConditionExtra condition that must be true for the rule to apply.
exceptionsMessageRuleConditionCondition under which the rule is skipped entirely.
is_bypasserbooleanfalseWhen true, this rule bypasses the rules named in bypasses.
bypassesstring[] | nullnullRule names that this bypasser rule skips. Only used when is_bypasser is true.

Rule types

Word filter

Triggers when the message contains a blocked word (whole-word match) or a blocked token (substring match).
{
  "type": "word_filter",
  "words": ["badword"],
  "tokens": ["badtoken"],
  "normalize": true,
  "actions": [
    { "type": "warn", "reason": "Automatic: Blocked word" },
    { "type": "delete_message" }
  ]
}
OptionTypeDefaultDescription
wordsstring[]Whole-word matches. The word must be surrounded by spaces or message boundaries.
tokensstring[]Substring matches. The token can appear anywhere inside a word.
normalizebooleantrueNormalizes the message and patterns before comparison (lowercases, removes diacritics).

Regex filter

Triggers when the message matches any of the provided regular expressions.
{
  "type": "regex_filter",
  "patterns": ["disc(o|0)rd\\.gg"],
  "actions": [
    { "type": "warn", "reason": "Automatic: Discord invite link" },
    { "type": "delete_message" }
  ]
}
The patterns array accepts either plain strings (treated as regex patterns with no flags) or [pattern, flags] tuples, where flags is a JavaScript regex flag string such as "i" for case-insensitive matching.

Anti-invite

Triggers when the message contains a Discord server invite link.
{
  "type": "anti_invite",
  "allow_internal_invites": true,
  "allowed_invite_codes": ["AbCdEf"],
  "actions": [{ "type": "delete_message" }]
}
OptionTypeDefaultDescription
allowed_invite_codesstring[][]Invite codes that are exempt from the filter.
allow_internal_invitesbooleantruePermits invites that point to the current server.

Domain filter

Triggers when the message contains a URL whose domain matches the blocklist.
{
  "type": "domain_filter",
  "domains": ["example.com"],
  "scan_links_only": false,
  "actions": [{ "type": "delete_message" }]
}
OptionTypeDefaultDescription
domainsstring[]Domains to block.
scan_links_onlybooleanfalseWhen true, only text that looks like a URL is checked.

MIME type filter

Triggers when a message attachment has a MIME type in the blocklist.
{
  "type": "mime_type_filter",
  "data": ["application/x-msdownload", "application/octet-stream"],
  "actions": [{ "type": "delete_message" }]
}
The data array contains MIME type strings such as "image/png" or "video/mp4".

File extension filter

Triggers when an attachment’s file extension is in the blocklist.
{
  "type": "file_extension_filter",
  "data": ["exe", "bat", "ps1"],
  "actions": [{ "type": "delete_message" }]
}

Repeated text filter

Triggers when the message contains an excessive number of repeated characters or words.
{
  "type": "repeated_text_filter",
  "max_repeated_chars": 20,
  "max_repeated_words": 15,
  "actions": [{ "type": "delete_message" }]
}
OptionTypeDefaultDescription
max_repeated_charsnumber20Maximum number of identical consecutive characters allowed.
max_repeated_wordsnumber15Maximum number of identical consecutive words allowed.

Mass mention filter

Triggers when a message contains more mentions than the configured limit.
{
  "type": "mass_mention_filter",
  "max_mentions": 10,
  "max_user_mentions": 8,
  "max_role_mentions": -1,
  "actions": [
    { "type": "warn", "reason": "Automatic: Mass mention" },
    { "type": "delete_message" }
  ]
}
OptionTypeDefaultDescription
max_mentionsnumber15Total mention limit (users + roles).
max_user_mentionsnumber-1User-only mention limit. -1 disables this check.
max_role_mentionsnumber-1Role-only mention limit. -1 disables this check.

Image filter

Scans text inside images using OCR and triggers if blocked words or tokens are found.
{
  "type": "image_filter",
  "words": ["blocked"],
  "tokens": ["tok"],
  "inherit_from_word_filter": false,
  "scan_embeds": false,
  "actions": [{ "type": "delete_message" }]
}
Set inherit_from_word_filter to true to reuse the word/token lists from the first word_filter rule instead of defining them again.

Embed filter

Triggers when an embed’s text content contains blocked words or tokens.
{
  "type": "embed_filter",
  "words": ["spam"],
  "tokens": ["buy now"],
  "actions": [{ "type": "delete_message" }]
}

Profile filter

Scans the user’s display name, username, and bio when they join or update their profile.
{
  "type": "profile_filter",
  "words": ["blocked"],
  "tokens": ["tok"],
  "regex_patterns": ["disc(o|0)rd\\.gg"],
  "normalize": true,
  "actions": [
    { "type": "warn", "reason": "Automatic: Profile contains blocked content" },
    { "type": "kick" }
  ]
}

AI scan

Uses the Google Perspective API to score message content across multiple harm categories.
{
  "type": "ai_scan",
  "toxicity_threshold": 0.75,
  "identity_attack_threshold": 0.5,
  "insult_threshold": 0.8,
  "profanity_threshold": 0.5,
  "threat_threshold": 0.5,
  "sexually_explicit_threshold": 0.5,
  "flirtation_threshold": 0.5,
  "actions": [
    { "type": "warn", "reason": "Automatic: AI-detected harmful content" },
    { "type": "delete_message" }
  ]
}
All threshold options default to 0.5. Set a threshold to a higher value to allow more latitude, or lower to be more strict.

File filter

Blocks specific files by their SHA-512 hash, regardless of the filename.
{
  "type": "file_filter",
  "hashes": {
    "d3d0bfbe67707d003ab937212ee96309b7f7beb6871391064917b70c20fa5a67": "image/png"
  },
  "check_mime_types": false,
  "actions": [{ "type": "delete_message" }]
}
The hashes object maps a SHA-512 hex string to a MIME type string (or null to skip MIME validation). Set check_mime_types to true to also verify that the attached file’s MIME type matches the value in the hash map.

Example: combined ruleset

{
  "YOUR_GUILD_ID": {
    "rule_moderation": {
      "enabled": true,
      "rules": [
        {
          "name": "staff-bypass",
          "type": "word_filter",
          "is_bypasser": true,
          "bypasses": ["invite-blocker"],
          "for": { "roles": ["STAFF_ROLE_ID"] },
          "actions": []
        },
        {
          "name": "invite-blocker",
          "type": "anti_invite",
          "allow_internal_invites": true,
          "actions": [
            { "type": "warn", "reason": "Automatic: No invite links" },
            { "type": "delete_message" }
          ]
        },
        {
          "type": "mass_mention_filter",
          "max_mentions": 8,
          "actions": [
            { "type": "mute", "duration": "5m" },
            { "type": "delete_message" }
          ]
        }
      ]
    }
  }
}

Build docs developers (and LLMs) love