AI Detection
AI Detection uses artificial intelligence to scan messages (and optionally images) for scams, phishing, and social engineering. Unlike rule-based filters, it analyzes the intent and context of content to catch threats that do not rely on known domains or patterns.
AI Detection is disabled by default and requires the AI_DETECTION feature on your subscription plan.
How It Works
- A message is posted in a monitored channel.
- Thrella checks the message against each enabled detection rule's criteria - channel filters, patterns, words, and trusted role bypass.
- The message content (and images, for rules with image scanning enabled) is sent to the AI provider for analysis against all eligible rules.
- If a rule's confidence threshold is met, that rule's configured action fires.
- The result is recorded in the AI Detection Log.
Each scan consumes tokens from your monthly allocation.
Configuration
AI Detection is configured on the AI Detection page in the dashboard, which has three tabs: Rules, Filters, and Server context. See the AI Detection Dashboard Guide for a walkthrough of the interface.
Reliability
Thrella supports a primary and fallback AI provider. If the primary provider fails (network issues, rate limits, or service outages), scanning automatically retries with the fallback provider. If both fail, the message is treated as safe - no false positives are generated from provider errors.
Confidence Threshold
Each detection rule has its own confidence threshold (0.1–1.0, default 0.7) that controls how sensitive that rule is. A detection must meet or exceed the rule's threshold to trigger its configured action.
- Lower threshold (e.g., 0.4) - catches more threats but increases false positives.
- Higher threshold (e.g., 0.9) - fewer detections, higher accuracy.
Start with the default threshold of 0.7. Monitor the AI Detection Log for a few days and adjust each rule's threshold based on the false positive rate in your community.
Scan Type
Each detection rule has a scan type that determines what content is analyzed:
- Text Only - scans message text only.
- Image Only - scans image attachments only.
- Text + Image - scans both message text and image attachments.
Image scanning uses more tokens per scan. The built-in rules come with default scan types appropriate for their detection category.
When a rule scans an image, the message's text content (the caption around the image) is also provided to the AI as context. This helps the AI understand whether an image is being shared innocently or accompanied by a scam pitch.
Minimum Message Length
Each rule has a Skip short messages option (on the Rules tab) that sets the minimum number of characters a text message must contain for that rule to scan it. Messages with less real text are skipped, which saves tokens on emojis, reactions, and brief replies. Setting it per rule is useful when one rule must catch very short scams while another only cares about longer messages. See Per-Rule Settings.
The length is measured against the message text after known-safe links are removed. Links to your allowlisted domains and to in-server navigation (channel and message jumps) are replaced with a neutral placeholder before scanning. As a result, a message that is mostly a safe link counts as short, and a benign link cannot on its own push a message into a false detection.
Messages with image attachments are always scanned, regardless of text length. If a message contains an image and only 2 characters of text, the image is still scanned by any rule that includes image scanning. Only the text portion is subject to the minimum.
Server Context
Found on the Server context tab, server context is a free-text field (max 500 characters) shared across all rules where you describe your server's purpose. This context is provided to the AI model to reduce false positives. For example, a crypto trading server might add context explaining that discussion of tokens and wallets is expected and not inherently suspicious.
Detection Prompts
Each detection rule has its own prompt (max 5,000 characters) that defines what the AI looks for. This allows different rules to analyze content for entirely different threat categories.
Rules with scan type Text + Image have two prompt fields, one for text scans and one for image scans. This lets you describe text threats and visual threats in their own words rather than cramming both into a single prompt. Rules with a single scan type (Text Only or Image Only) have just one prompt field.
Key points:
- The output format is locked. No matter what you write in a rule's prompt, Thrella always appends a fixed JSON schema section. The AI always returns the exact structure the parsers expect, so a custom prompt cannot break the response format.
- Your prompt can include
{guild_context}as a placeholder for the server context configured on the Server context tab. - Token cost: Longer prompts consume more tokens per scan.
- Built-in rules have a "View Default" button to see the default prompt and a "Reset" button to restore it.
- Custom rules: Write your prompt from scratch to define exactly what the AI should detect.
For built-in rules, click "View Default" to see the default prompt as a starting point. Copy it and make targeted modifications rather than writing from scratch.
Channel Filters
Each detection rule has its own excluded and included channel lists:
- Excluded channels - channels added to this list skip scanning for that rule.
- Included channels - when set, only messages in these channels are scanned by that rule.
Different rules can monitor different channels. For example, a scam detection rule might monitor all channels while a toxicity rule only monitors specific discussion channels.
Include/Exclude Patterns
Found on the Filters tab, regex patterns apply globally across all detection rules:
- Include patterns - only messages matching at least one include pattern are scanned. If no include patterns are set, all messages are eligible.
- Exclude patterns - messages matching any exclude pattern skip scanning, even if they match an include pattern.
Exclude takes priority over include. Maximum 20 total patterns across both lists.
Include/Exclude Words
Found on the Filters tab, keyword filters apply globally across all detection rules and work the same way as patterns:
- Include words - only messages containing at least one include word are scanned.
- Exclude words - messages containing any exclude word skip scanning.
Exclude takes priority over include. Maximum 50 total words across both lists.
Per-Rule Settings
Each detection rule supports independent configuration for the following settings:
- Action - the action to take when the rule triggers (LOG_ONLY through DELETE_BAN).
- Scan Type - Text Only, Image Only, or Text + Image.
- Confidence Threshold - the minimum confidence score required to trigger the action (0.1–1.0).
- Timeout Duration - when the action is DELETE_TIMEOUT, the timeout length for that rule.
- DM Notification - toggle whether the user receives a DM when the rule triggers, with an optional custom message (variables:
{guildName},{reason},{duration}). - Public Notification - toggle whether a public notification is posted when the rule triggers, with an optional custom message (variable:
{user}). - Trusted Role Bypass - toggle whether members with trusted roles bypass that rule.
- Excluded Channels - channels that skip scanning for that rule.
- Included Channels - when set, only messages in those channels are scanned by that rule.
- Categories the AI may assign - optionally restrict which threat categories this rule is allowed to assign. Leave empty to allow any category.
- Minimum Characters ("Skip short messages") - the shortest text message this rule scans, measured after safe links are removed. Leave it off to scan text of any non-empty length. Applies to text scans only - image scans ignore it.
- Detection Prompt - the analysis instructions the AI receives for that rule.
For details on action levels, see Filter Actions Reference.
Built-in Rules
Thrella includes two built-in detection rules that cannot be deleted and do not count against your custom rule limit:
| Rule | Default State | Scan Type | Default Action | Description |
|---|---|---|---|---|
| Scam & Phishing | Enabled | Text + Image | DELETE_WARN | Detects scams, phishing attempts, and social engineering |
| Toxicity & Hate Speech | Disabled | Text Only | DELETE_WARN | Detects toxic, abusive, or harassing content |
Built-in rules can be fully customized - you can change their action, threshold, prompt, channels, and all other per-rule settings.
Custom Rules
You can create custom detection rules with your own prompts to detect anything specific to your community. Custom rules have all the same per-rule settings as built-in rules.
The number of custom rules you can create is determined by your subscription tier's maxAiRules limit. See Tier Limits for details.
Token Usage
AI Detection consumes tokens from your server's monthly allocation. Your allocation is determined by your subscription plan plus any add-on subscriptions or one-time token packs you have purchased.
Tokens are consumed in the following order:
- Plan allocation - your base monthly tokens are used first.
- Add-on subscription - additional recurring tokens are used next.
- One-time packs - purchased packs are consumed in FIFO order (oldest first). Fully consumed packs are automatically removed.
Plan and add-on tokens reset at the start of each billing period - your plan's renewal date for paid servers, or the first of the month for free servers. One-time pack tokens do not reset; once consumed, they are permanently depleted.
- Notifications are sent to your alert channel at 80%, 95%, and 100% usage (once per billing cycle). Thresholds are calculated against your total budget (plan + add-on + one-time credits).
- When tokens run out, AI scanning pauses automatically. All other security filters continue working normally.
Token usage is tracked persistently and survives service restarts. Your usage count is always accurate, even after bot updates or maintenance.
Monitor your token usage on the AI Detection page header badge or on the Billing page. To purchase additional tokens, see AI Tokens.
Dashboard
The AI Detection page in the dashboard has three configuration tabs and a separate Log sub-page:
- Rules - manage detection rules, view per-rule stats, test rules, and create custom rules.
- Filters - configure global include/exclude patterns and words.
- Server context - describe your server so the AI understands what is normal.
- Log - browse scan results with confidence scores, categories, reasoning, and actions taken.
See the AI Detection Dashboard Guide for full details.
Access to the AI Detection page requires the AI_DETECTION dashboard permission, which is separate from the SECURITY permission.